1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Discord bot that will track who sent a screenshot in the thread

Discussão em 'Python' iniciado por Stack, Outubro 5, 2024 às 22:52.

  1. Stack

    Stack Membro Participativo

    I made a BOT that's helping with our events in game. Right now it does append list of users who reacted with thumbsup and post their names in the thread it's creating after being told (moneybag reaction added by message author).

    People are supposed to send a screenshot in this thread AND add moneybag reaction to the PREVIOUS message. The point is that users usually forget to add that reaction and I'd like to remind them so:

    1. BOT will inform whenever someone adds that reaction.
    2. BOT would ping user after 20h with a message that they're missing reaction.

    Here's the part of my code where bot:

    • doesn't let moneybag reaction if not skull reaction
    • filters message
    • append list of users who reacted with thumbsup
    • creates the thread
    • send users names in the thread

    I'm not sure if I should make it (the part Id like to implement) for on_reaction_add or rather on_thread_create, maybe both? Can someone help me with this? I'm pretty new to python.

    if user == reaction.message.author and str(reaction.emoji) == "":
    channel = client.get_channel(1245389918361092126) #-payments

    moneybag_reaction = discord.utils.get(reaction.message.reactions, emoji='')
    skull_reaction = discord.utils.get(reaction.message.reactions, emoji='\U00002620\U0000fe0f')
    print("2")

    if not skull_reaction:
    print("3")
    await moneybag_reaction.remove(user)
    return


    mention_regex = re.compile(r"^<@&(\d+)> ")
    filtered_content = mention_regex.sub("", reaction.message.content, 1)
    print(filtered_content)
    message = await channel.send(f"{filtered_content} by {reaction.message.author.mention}")
    await message.add_reaction("")


    thumbsuplist = []
    message = reaction.message
    for reaction in message.reactions:
    print("2")
    if reaction.emoji == '':
    async for user in reaction.users():
    if user != client.user:
    thumbsuplist.append(user.mention)
    joined = ", ".join(thumbsuplist)
    print(joined)



    thread_name = f"{filtered_content} by {reaction.message.author.display_name}"
    thread = await channel.create_thread(name=thread_name, auto_archive_duration=1440, reason=None, type=discord.ChannelType.public_thread)
    await thread.send(str(joined))

    Continue reading...

Compartilhe esta Página