Untitled
unknown
plain_text
2 years ago
833 B
10
Indexable
import discord
from discord import Intents
from PyDictionary import PyDictionary
client = discord.Client(intents=discord.Intents.all())
dictionary = PyDictionary()
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!dictionary'):
word = message.content.split(' ')[1]
definition = dictionary.meaning(word)
if definition:
for key, val in definition.items():
await message.channel.send(f'**{key}**: {", ".join(val)}')
else:
await message.channel.send('Sorry, I could not find a definition for that word.')
client.run('MTIyNjQ4NTAzNzk1Mjc5NDY2NQ.G9UZ6p.a7MLmRD6w9Nn50ojn7LOILWNtgXDEiYtbD3j0k')Editor is loading...
Leave a Comment