【问题标题】:How can I ban users that join in x time? [closed]如何禁止加入 x 时间的用户? [关闭]
【发布时间】:2021-10-17 13:47:50
【问题描述】:

如何禁止该组内的所有用户:在 x 秒内加入和 x 个用户。 例子: 如果7个用户在20s内全部加入服务器,它会禁止所有7个。

我有一个 db,postgres,但我不知道该怎么做。

【问题讨论】:

  • 欢迎来到 Stackoverflow!,不幸的是,这个问题有点太模糊了,它非常笼统地询问构成教程的内容,而不是询问具体问题。因此它不适合 stackoverflow,因为 Stackoverflow 不是教程提供者或免费的代码编写服务,我建议新用户查看 stackoverflow 的 How to ask 部分,以获取有关提出非常适合该站点并最好启用的问题的提示社区提供有用的反馈。祝你好运:)

标签: python discord discord.py


【解决方案1】:

这是我能想到的最好的方法

@client.command()
async def ban_all_time(ctx:commands.Context):
    "add to the db that at the guild every one who joined should get banned"
    asyncio.sleep(time)
    "change at the db that at the guild every one who joined shouldn't get banned"
@client.event
async def on_member_join(member:discord.Member):
    if "check in the db if they need to get banned":
        await member.ban()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    • 1970-01-01
    • 2018-11-13
    • 2022-01-07
    • 2017-07-08
    相关资源
    最近更新 更多