我在discord.py上的开关似乎不起作用,我也不清楚原因。有人能指出我犯了什么错误吗?谢谢。 @client.command(aliases=["shut","shutdown","quit","stop_that","stahp", "kill"])
async def stop(ctx):
await ctx.send("Attention: I have been murdered.")
await client.logout()
我正在尝试设置静音命令。下面的代码没有给出任何错误,但它不起作用。
@client.command()
@commands.has_permissions(manage_messages=True)
async def mute(ctx, member : discord.Member) :
guild = ctx.guild
user = member
global mute_role
for role in guild.roles:
if role.name == "MUTED" :
if role
如何检查特定渠道中的默认角色拥有哪些权限?
我试过了:
if member.default_role.permission_in(channel).send_message:
但是,如果没有错误消息,它将无法工作。我试过的其他方法也都不起作用。
下面是我的代码:
@commands.command()
async def unmute(self, ctx, member: discord.Member):
if ctx.author.guild_permissions.kick_members:
for channel in ctx.guild.text_channel
我刚开始做一个不和谐的机器人。我想做一个命令,你可以输入-queue duos与其他人谁也想排队游戏。但是,我的添加角色命令完全没有响应,当我在Discord中键入命令时,也不会给出角色或错误。
import discord
import os
#run the Bot and a message to make sure it ran
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
我想在discord.py中创建一个提醒命令,这个命令会提醒一个特定的角色事件即将到来。为此,我在第一个变量中保存了事件开始的时间,在第二个变量中,我减去了事件开始的时间和提前的分钟。然后,我将第二个变量放在async.io函数中,以便只给出提醒。
例如,如果事件在20:00开始,提前时间是2,机器人应该在19:58提醒。
但是这不起作用,我在控制台上得到了以下错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: int() argument must be a s
我有一个GitHub回购:。
这上面有我的科多瓦文件。当我试图编译它时,cordova给出了以下错误:
enzotech2@iLuvLinux:~/Documents/GitHub/Switcher$ cordova build android Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'. Try update y
我尝试了很多其他人的解决方案,但都不起作用。那么,我如何获得一个在MS中显示ping的ping命令呢? 这是我的代码,我没有得到任何错误,尽管它只是不回应我的CMD。 import os
from keep_alive import keep_alive
from discord.ext import commands
import time
import random
bot = commands.Bot(
command_prefix="!", # Change to desired prefix
case_insensitive=True
我正在尝试为discord.py重写中的不一致创建一个自动机,它给出了这个错误: Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "me" is not found 下面是我的代码: from discord.ext import commands
selfbot = commands.Bot(command_prefix = "<.", self_bot = True)
selfbot.event
async def o
我试图执行一个info命令,正如您可以看到的那样,但是在角色部分,我不能显示用户的角色。起初,我执行了一个工作命令,但是它也显示了"@everyone“角色,所以我做了一个字符串来删除它(mention.remove("everyone")),但是它不能工作--它给出了一个错误:
Command raised an exception: ValueError: list.remove(x): x not in list
我也试着用“每个人”来代替“每个人”,但它仍然不起作用。
@client.command()
async def info(ctx, user: dis