Last active
November 22, 2020 11:21
-
-
Save blacksmithop/2e3dac6cdd6a512a7f10751e91db15ae to your computer and use it in GitHub Desktop.
A basic Python discord Bot
This file contains hidden or 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
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