标签:discord.py
-
发送指定频道/ Python Discord的消息 - python
@Bot.command(pass_context = True) async def xsend(ctx, *, message): await Bot.delete_message(ctx.message) await Bot.send_message(discord.Object(id='408104999038746635'), […]
-
我如何检查用户是否在不和谐中扮演特定角色 - python
这应该检查特定人员是否具有静音角色 @bot.command(pass_context=True) @commands.has_role("Admin") async def unmute(ctx, user: discord.Member): role = discord.utils.find(lambda r: r.name == & […]
-
更改joind_at时区discord.py - python
我已经尝试了许多涉及pytz的方法来更改discord.py user.joined_at时间的时区。它在UTC中,我需要在EST中使用。 我所做的是 eastern = timezone('US/Eastern') eastern.zone fmt='%#c jointime=eastern.localize(datetime […]
-
不和谐静音命令 - python
我目前正在尝试制作一个能够使用户静音的不和谐机器人。到目前为止,我已经创建了此脚本,该脚本允许具有“ staff”角色的人员运行该命令,并为标记的用户提供“ Mute”角色。如果还不存在,它还会创建一个。问题是下面的代码不起作用。它在控制台中什么也没有说,但是如果您具有职员角色并运行命令,则不会发生任何事情。 @commands.has_role(" […]
-
Discord.py重写自定义错误 - python
我对编码非常陌生,我想知道如何在此处实现自定义错误,例如“缺少开发人员角色”: @bot.command() @commands.has_any_role("Temp.", "Owner") async def sh(ctx): await ctx.message.add_reaction(':true:50 […]
-
如何检查ctx是否为私人频道(dm频道) - python
本质上,我希望此命令仅在DMS中运行,并且不能在我的机器人所在的服务器中激活,我知道有一个检查器,但我不确定如何准确地使用它,感谢您的帮助 class verify: def check(): #something @bot.command() @commands.check(check) async def verify(ctx): python大神给出的 […]
-
Discord.py重写所有命令的收集列表 - python
我正在尝试获取Discord机器人中所有命令的列表以进行重写。我正在使用Python 3.6编写此 我试图通过执行打印命令列表print(bot.commands)这仅为我提供以下回报: {<discord.ext.commands.core.Command object at 0x00000209EE6AD4E0>, <discord.e […]