Dan's Brain

Discord


Fonti

Bot

Discord.py is a well supported wrapper for the discord API.

  • To add a command use async def
  • Adding a prefix to commands helps find issued commands
  import discord, io, os
  from discord.ext import command
  DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN")

  ## First command
  @bot.command()
  async def hello_world(context):
      await context.send("Hello!")

  ## Start the bot
  bot.run(DISCOND_TOKEN)

Tools