#๐Ÿ”’ Python

16 messages ยท Page 1 of 1 (latest)

hushed oxideBOT
#

@verbal moon

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

verbal moon
#

Role Status

last bobcat
#

hello, please try posting your question with the Discord invite masked

verbal moon
#

my code deletes all the time

last bobcat
#

it's because of the Discord invite link

verbal moon
#

I coughed them up

#
REMOVE_ROLE_ID = 1226953019573407755

@bot.command()
async def get_role(ctx):
    activities = ctx.author.activities
    for activity in activities:
        if isinstance(activity, discord.CustomActivity) and "TEST" in activity.name:
            member = ctx.author
            add_role_id = ADD_ROLE_ID
            remove_role_id = REMOVE_ROLE_ID
            add_role = discord.utils.get(ctx.guild.roles, id=add_role_id)
            remove_role = discord.utils.get(ctx.guild.roles, id=remove_role_id)

            if add_role:
                await member.add_roles(add_role)
                await ctx.send(f"Role {add_role.name} added.")
            else:
                await ctx.send("The role to add does not exist.")

            if remove_role and remove_role in member.roles:
                await member.remove_roles(remove_role)
                await ctx.send(f"Role {remove_role.name} removed.")
            return
    await ctx.send("You must have 'TEST' in your custom status to use this command.")```
#

even with the TEST status it does nothing with the roles

#

@last bobcat

last bobcat
#

I'm the wrong person to ask for Discord bots

verbal moon
#

ok ok

last bobcat
#

perhaps try asking in #discord-bots, if you don't find help here

verbal moon
#

ok

hushed oxideBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.