I am already building a discord.py bot. However, I want to make it assign roles without the use of prefix in a specific channel - I mean in #roles channel. If a member writes "Mage", and if Mage role is already created, bot will assign the role to member. I looked for a reaction role but I need something more specific. I am waiting for your ideas and help. Have a great day!
0
votes
Welcome to StackOverflow. This isn't a free service where we write a code for you. You have to try yourself and show us what you've done, and we can help along the way. Have a read on how to ask a good question! For your question itself, maybe this can guide you a bit
– AbdurJ
I am sorry for ask write code for me. I know its being lazy but I tried a lot and search couldn't find it. I keep in mind for next question.
– Efe Umut Aslan
1 Answers
0
votes
@client.event
async def on_message(message): # Using on_message event reference you dont need to have a prefix
guild = message.author.guild
if message.content.lower() == "what the message name should be": # Checks if the WHOLE message is that one word, so not if that one word was part of a message
role = discord.utils.get(guild.roles, name="role name") # Gets the role
if role is not None: # makes sure role exists
await message.author.add_roles(role) # Assigns role to the message author