Skip to content

Instantly share code, notes, and snippets.

@Himan10
Created February 18, 2020 20:10
Show Gist options
  • Select an option

  • Save Himan10/d661a65047fdfc36a2e4a73fa23866d5 to your computer and use it in GitHub Desktop.

Select an option

Save Himan10/d661a65047fdfc36a2e4a73fa23866d5 to your computer and use it in GitHub Desktop.
Checking basic functionality of discord bot
#/home/hi-man/anaconda3/bin/python
import os
import discord
from dotenv import load_dotenv
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
guild = os.getenv('CONSTRUCT_CODES')
client = discord.Client()
class MyClient(discord.Client):
async def on_ready():
print(f'Logged in as : {client.user}')
async def on_message(message):
message.content = message.content.lower()
if message.author == client.user:
return
if message.content.startswith('!hey'):
await message.channel.send('Hello..')
client.run(token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment