Skip to content

Instantly share code, notes, and snippets.

@100ze
Last active November 5, 2020 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 100ze/1a25c0a713404de4187c7c803d66ba21 to your computer and use it in GitHub Desktop.
Save 100ze/1a25c0a713404de4187c7c803d66ba21 to your computer and use it in GitHub Desktop.
# importando módulos
import os
from dotenv import load_dotenv
# importando módulo de bots da biblioteca Discord.py
from discord.ext import commands
# pegando o token salvo no arquivo .env
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
# definindo o prefixo do bot e armazenando o objeto 'bot'
bot = commands.Bot(command_prefix='!')
# mostrando algo no terminal quando o cliente se conectar
@bot.event
async def on_ready():
print('{0.user} se conectou com sucesso :)'.format(bot))
# conectando ao Discord
bot.run(TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment