python-3.x - 如何在 discord.py 中检查以前制作的不和谐邀请?
问题描述
每当运行此命令时,都会发出新的不和谐邀请。有没有办法让机器人检查以前发出的邀请?
@client.command()
async def invite(ctx):
link = await ctx.channel.create_invite()
sender = ctx.message.author.id
await ctx.author.send(f"<@{sender}>, your invite link is {link}")
await ctx.send(f"<@{ctx.message.author.id}>, an invite link has been sent to your DMs!")
解决方案
使用:await guild.invites()
https ://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.invites
你可以很容易地获得该公会中所有邀请的列表
推荐阅读
- c# - 有没有一种很好的方法来访问 xaml 中嵌套控件的属性?
- sql-server - SQL Server 错误:在表上引入外键约束可能会导致循环或多个级联路径
- c++ - 如何使用可变数量的基类使基类的运算符可见(请参见下面的代码)?
- ansible - Ansible playbook 创建相对链接
- python-3.x - Docker python无法导入通过apt-get安装的模块
- sql - 如何分析实际执行计划并创建非聚集索引来帮助查询
- javascript - Google 跟踪代码管理器使用沙盒 JavaScript?
- javascript - 使用reduce并跳过其中包含0的数组?
- excel - 问:Google Sheet 根据单元格返回值,true 为 false
- sql - 从交易查询中过滤债务人