python - 如何在 pythons 中为不和谐的机器人使用 client.delete_channel() 命令
问题描述
我需要知道如何在 discord.py 中使用 delete_channel 命令可能有人请发布代码示例
解决方案
以下是使用命令删除频道的方法
from discord.ext.commands import Bot
import discord
bot=Bot(command_prefix='.')
这是在async
版本中,可能是您正在使用的版本
@bot.command(pass_context=True)
async def del_chan(msg,channel:discord.Channel):
await bot.delete_channel(channel)
这是在rewrite
@bot.command()
async def del_channel(msg,chan:discord.TextChannel):
await chan.delete()
要使用您会执行的命令.del_chan #channel_name
, .del_chan channel_name
, .del_channel #channel_name
, 或.del_channel channel_name
推荐阅读
- java - Drools 不能对 DRL 中的函数参数使用泛型类型
- php - 尝试通过从选定表中获取列名来构建我的查询
- javascript - 在 reactJS 中以高阶组件执行计算
- reactjs - 带有 okta 和 react-persist 的无限循环
- r - R 传播问题:添加新的更新数据后,spread() 创建瀑布数据框
- javascript - JavaScript - X 年内总计的通货膨胀/升级
- javascript - Vis js - 网络图上的操作模式事件
- node.js - 在查找命令处理程序时遇到问题
- sql - 如何选择字符串中连字符后的前 8 个字符?
- rpa - 无处不在的自动化。在对象克隆命令中使用变量选择窗口