如何在自定义异常上发送嵌入?
例外:
class CustomError(commands.CommandError):
def __init__(self, message):
self.message = message
super().__init__(self.message)
def __str__(self):
return self.message
调用异常的代码:
if not ctx.voice_client or ctx.voice_client.queue.is_empty():
rais
我用python为自己做了一个简单的IRC机器人,效果很好,但现在一些朋友问我,这个机器人是否也可以加入他们的IRC频道。他们的IRC通道非常活跃,它是Twitch chat(IRC包装器),这意味着很多消息。我想让他们使用我的机器人,但我不知道它将如何执行,这是我制作的第一个机器人。
现在我的代码是这样的:
Connect to IRC server & channel while true: Receive data from the socket (4096, max data to be received at once) do something wit
我正在构建一个机器人,我想让它在我的服务器上指定一个特定的角色,如果他们给机器人一个特定的密码。
if message.guild is None:
if message.guild is None:
if passphrase in message.content:
await message.channel.send("You've been verified!")
我已经让机器人识别了事件,但我不知道如何为用户分配我想要的角色。
我将如何让机器人在我的服务器中在这个if语句中指定特定的角色?
我想创建多个机器人与所有自己的唯一id。但是,如何为众多机器人自动执行此操作,并拥有所有其他id呢?我可以使用bot1,bot2,但是如果我想使用100个机器人怎么办?
class newbot:
id = randomid()
bot1 = newbot()
bot2 = newbot()
print bot1.id
print bot2.id #all the same id