tempmute– Command for temporarily muting a user from the discord server. !clear– Command for clearing the messages of a channel. !role-info– Command for extracting the information related to a specific role. !user-info– Command for getting information about a user. !server-info– Command ...
使用channel.purge()应该可以做到这一点。如果bot帐户有足够的权限,这将删除指定通道中的每条消息。 代码语言:javascript 复制 @self.discord_bot.command() async def clear(ctx): try: if ctx.channel != self.channel_name: return # clear history await ctx.channel.purge(limit=None) except Exception as ...
@bot.command(pass_context=True) @commands.has_permissions(administrator=True) async def clean(ctx, limit: int): await ctx.channel.purge(limit=limit) await ctx.send('Cleared by {}'.format(ctx.author.mention)) await ctx.message.delete() @clean.error async def clear_error(ctx, error): if ...
CommandFunction setnickChanges the nickname of a member banBans a member unbanUnbans a member kickKicks a member vkickKicks a member from one of the voice channel voice channels mute textMutes a member in a text channel and disables their text permission ...
Fix 6. Clear Discord Cache Clearing the Discord cache is another great fix. Now it's important that users follow the right method of removing the cache. This means going into the AppData folder and manually deleting the cache files like this. Step 1. Open the run command by pressing Windo...
value=f'{ctx.channel.mention}', inline=True ) await logs_moderazione.send(embed=embed) @clear.error async def clear_error(ctx, error): i = 0 embed=discord.Embed( color=0xa61022 ) if isinstance(error, app_commands.CommandOnCooldown): cd = round(error.retry_after) time = str(datetime...
@bot.command() async def clear(ctx, amount: int): await ctx.channel.purge(limit=amount+1) bot.run('your_token') 上述代码创建了一个名为clear的自定义清除命令。用户可以使用!clear <amount>的格式来调用该命令,并指定要删除的消息数量。当命令被调用时,机器人将会删除指定数量的消息,包括命令本身。
你好,我正在尝试创建一个音乐机器人,但我想要它,这样我就可以播放音乐并使用相同的命令将其他音乐添加到队列中。我尝试过这样做,但我无法让它工作。这是播放和队列是两个独立命令的代码: @bot.command(pass_context=True)asyncdefjoin(ctx):awaitbot.join_voice_channel(bot.get_channel('487315853482786820'))@bot...
PressWindows+Sto openSearch, typeCommand Promptin the text field, and click onRun as administrator. ClickYesin theUACprompt. Paste the following commands individually and hitEnterafter each:ipconfig /flushdnsipconfig /registerdnsipconfig /releaseipconfig /renewnetsh winsock reset ...
You can use two commands to delete messages from the channel. The ‘!clear (number)’ command will delete the designated number of most recent messages from a channel. PressEnterorSendto execute the command. That will delete only the last message. ...