Skip to content

Instantly share code, notes, and snippets.

@Kqpa
Created December 27, 2021 17:02
Show Gist options
  • Save Kqpa/9a1b669d5957f0ffd2c2806d162644e4 to your computer and use it in GitHub Desktop.
Save Kqpa/9a1b669d5957f0ffd2c2806d162644e4 to your computer and use it in GitHub Desktop.
Python Discord Bot
# Get started by creating a project in Replit
import os, discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!!")
@bot.event
async def on_connect():
await bot.change_presence(status=discord.Status.online,
activity=discord.Game('This is the bots activity status.'))
print("Bot is online.")
@bot.command()
async def hello(ctx):
await ctx.send("Hey")
bot.run(os.getenv('TOKEN'))
my_secret = os.environ['TOKEN']
# create a secret named 'TOKEN' and put your bot's token to the value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment