Reputation: 3
I have a bot that currently does nothing other than keep itself hosted online
I have tried finding an answer to this but everything is for Javascript
basically what I'm looking for is a bot that:
When someone sends a message detect if he has role "X" If he has role "X" reply with a prewritten message
for example, if someone has a role named "PlaysROR2" whenever he types the word game the bot will send the message ROR2
I'm new to making discord bots and python in general so the more specific the answer the better from what I understood there's no Has_role function so it's pretty complicated
Upvotes: 0
Views: 349
Reputation: 144
@client.event
async def on_message(message):
role = discord.utils.get(message.guild.roles, name="PlaysROR2")
if role in message.author.roles and message.content == "game":
await message.channel.send("ROR2")
else:
return
Try this? I'm not very good at discord.py, sorry, and I haven't tested this yet so it might not work.
Upvotes: 1