Skip to content

Instantly share code, notes, and snippets.

@blacksmithop
Last active November 22, 2020 11:21
Show Gist options
  • Save blacksmithop/2e3dac6cdd6a512a7f10751e91db15ae to your computer and use it in GitHub Desktop.
Save blacksmithop/2e3dac6cdd6a512a7f10751e91db15ae to your computer and use it in GitHub Desktop.
A basic Python discord Bot
from discord.ext import commands
from discord import Status, Game
from discord.errors import LoginFailure
bot = commands.Bot(command_prefix="?")
@bot.listen('on_ready')
async def bot_is_ready():
print(f"Logged in as: {bot.user}")
await bot.change_presence(status=Status.online, activity=Game(f"{bot.command_prefix}help"))
if __name__ == '__main__':
token = getenv('BOT_TOKEN')
try:
bot.run(token)
except LoginFailure:
print("Improper Token was passed!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment