如何检查特定渠道中的默认角色拥有哪些权限?
我试过了:
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
在我的try块中,我添加了两个异常。如果机器人没有权限,则为一个异常,对于其他情况则为另一个异常。但是,下面的代码没有显示权限错误的异常,而是使用了另一个异常。
@commands.command(no_pm=True)
async def mal(self, *, srch=None):
try:
if srch is None:
await self.Nao.say('You need to provide an anime name')
return
我正在开发AWS函数.I,通过上传用Java 8编写的压缩文件和源代码(项目)来部署它。
项目是使用gradle构建的。成功构建后,它将生成部署zip。
当我在Lambda函数中部署本地生成的zip时,这非常好。
工作场景:
Zip generated through gradle build locally in workspace -> copied to AWS S3
location -> specify the s3 zip path in Lambda upload/specify URL path field.
但是当我从jenkins生成gradle构建时,生成的
我想使用默认的无服务器模板测试部署无服务器项目,但是我得到了这个错误
An error occurred: HelloLogGroup - User: arn:aws:iam::346468483688:user/crm_development is not authorized to perform: logs:DescribeLogGroups on resource: arn:aws:logs:us-east-1:346468483688:log-group::log-stream: (Service: AWSLogs; Status Code: 400; Error Code: Ac
@client.hybrid_command(name="bet", aliases=["gamble"],with_app_command=True,description="Gamble away your money or get a jackpot!")
@commands.guild_only()
@commands.cooldown(1,7,BucketType.user)
@app_commands.guilds(discord.Object(id = 1009907559391567912))
async def bet(ctx,
如何为discord.py斜杠命令添加权限?在斜杠命令中没有@has_permissions()。
@slash.slash(
name="kick",
description="Kicks member from the server",
options=[manage_commands.create_option(
name = "member",
description = "Who do you want to kick?",
option_type
如果我把这个放在main.py中,机器人就坏了,没有命令可以工作,但我没有错误
@client.event
async def on_message(message):
if client.user.mentioned_in(message):
embed=discord.Embed(description='My prefix here is ?. You can see available commands by typing `?help`', color=0x850000)
await message.channel.send(e
我想从他们的Id中得到一个用户的昵称。我有以下代码:
id = 235088799074484224 # User Id
member2 = bot.guilds[guild_id].get_member(id)
print(member2.nick)
但是代码给出了一个错误:
Traceback (most recent call last):
File "C:\Users\Vlad\PycharmProjects\untitled\venv\lib\site-packages\discord\client.py", line 333, in _run_event