Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Movie-ChatBot/discord.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (20 sloc)
650 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
def read_token(): | |
with open ("token.txt", "r") as file: | |
lines = file.readlines() | |
return lines[0].strip() | |
token = read_token() | |
client = discord.Client() | |
@client.event | |
async def on_message(message): | |
if message.author == client.user: | |
return | |
if message.content != 'hello': | |
await message.channel.send('Sorry I do not understand. Can you repeat please.') | |
else: | |
await message.add_reaction('\U0001F60E') | |
await message.channel.send("Hi, I am a Movie Chat bot. It is very nice to see you!") | |
@client.event | |
async def on_ready(): | |
print("Bot is online!") | |
client.run(token) | |