'How to make my discord bot send an emoji if a message has a emoji in it?
I am trying to make my discord bot send an emoji whenever the message has an emoji in it. With my code it does even throw back and error, and does not send a message to the guild.
import discord
import os
TOKEN = os.environ['something'] #for obvious reasons
client = discord.Client()
@client.event
async def on_message(message):
emojis = [':grin:', ":joy:", ":rofl:", ":scream:",":+1:",":-1:"]
for i in message.content:
if i in emojis :
await message.channel.send(i)
client.run(TOKEN)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
