Skip to content

Instantly share code, notes, and snippets.

@judge2020
Last active April 4, 2024 08:49
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 judge2020/4a996a26058562bb4bf38b5c679528d2 to your computer and use it in GitHub Desktop.
Save judge2020/4a996a26058562bb4bf38b5c679528d2 to your computer and use it in GitHub Desktop.
Initialize Discord bot in Python 3
  1. python3 -m pip install discord.py
  2. copy the script into a file (e.g. initialize.py)
  3. run python3 initialize.py
  4. quit once you see "We have logged in as <user#1234>"
import discord
import getpass
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
client.run(getpass.getpass(prompt='Discord Bot Token: ', stream=None))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment