gpt4 book ai didi

c# - 检测 IRC 用户是否为 "voice"或更高 [C# irc bot]

转载 作者:太空狗 更新时间:2023-10-29 20:08:22 25 4
gpt4 key购买 nike

我有一个命令,我想将其限制在某些级别。我正在使用 unreal3.2.6 IRC。

我读到这个:enter image description here

但我仍然不确定我可以做些什么来检查用户排名。

我想看看用户是否是“语音”或更高级别。什么可以查找用户,我该怎么做才能检查他们是语音还是更高级别?我要检查的每个等级的值是多少?

我只是想检查当前 channel ,而不是整个 IRC 服务器。

例如:

当用户尝试执行命令 !roll (掷骰子) 并且不是 Voice 或更高级别时,什么也不会发生。

if (data.Equals("!roll"))
{
//Check if user contains (@,+,etc?)
if(nickname.StartsWith(@..+..etc))
{
roll(nickname);
}
}

最佳答案

而不是使用 WHOIS 查询用户命令,需要用NAMES查询适用的 channel 命令。

来自 RFC 2812 - Internet Relay Chat: Client Protocol :

3.2.5 Names message

Command: NAMES

Parameters: [ <channel> *( "," <channel> ) [ <target> ] ]

By using the NAMES command, a user can list all nicknames that are visible to him. For more details on what is visible and what is not, see "Internet Relay Chat: Channel Management" [IRC-CHAN]. The <channel> parameter specifies which channel(s) to return information about. There is no error reply for bad channel names.

If no <channel> parameter is given, a list of all channels and their occupants is returned. At the end of this list, a list of users who are visible but either not on any channel or not on a visible channel are listed as being on 'channel' "*".

If the <target> parameter is specified, the request is forwarded to that server which will generate the reply.

Wildcards are allowed in the <target> parameter.

Numerics:

ERR_TOOMANYMATCHES ERR_NOSUCHSERVER
RPL_NAMREPLY RPL_ENDOFNAMES

Examples:

NAMES #twilight_zone,#42 ; Command to list visible users on #twilight_zone and #42

NAMES ; Command to list all visible channels and users

使用 NAMES 查询 channel 命令将产生这两个回复:

353 RPL_NAMREPLY

"( "=" / "*" / "@" ) <channel>
:[ "@" / "+" ] <nick> *( " " [ "@" / "+" ] <nick> )

  • "@" is used for secret channels, "*" for private channels, and "=" for others (public channels).

还有:

366 RPL_ENDOFNAMES

"<channel> :End of NAMES list"

您可以根据空白字符拆分缺号列表,并确定缺号的第一个字符是模式标识符( +@ 等)还是字母数字字符(这意味着用户在 channel 上没有特殊模式。)

IRC标准只定义了+作为有声用户和@作为 channel 运营商,但其他服务器可以使用特殊字符,如 ~对于 channel 所有者和 &对于“ super ” channel 运营商。作为一般规则,您可以简单地检查用户是否有任何 channel 模式(默认设置除外)以验证他们是否有语音或更好。

关于c# - 检测 IRC 用户是否为 "voice"或更高 [C# irc bot],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8188599/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com