• Stars
    star
    558
  • Rank 77,200 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🍺 A simple discord bot that helps you getting started within discord.py

discord_bot.py

Do you need more help? Visit my server here: https://discord.gg/AlexFlipnote 🍺

Requirements

Useful to always have

Keep this saved somewhere, as this is the docs to discord.py@rewrite. All you need to know about the library is defined inside here, even code that I don't use in this example is here.

This code is also made to be as typing friendly as possible with comments and everything. I recommend having Visual Studio Code with the Python extension installed to help you out with the code.

How to setup

  1. Make a bot here and grab the token Image_Example1

  2. Rename the file .env.example to .env, then fill in the required spots, such as token, prefix and game

  3. To install what you need, do pip install -r requirements.txt
    (If that doesn't work, do python -m pip install -r requirements.txt)
    NOTE: Use pip install with Administrator/sudo

  4. Start the bot by having the cmd/terminal inside the bot folder and type python index.py

  5. You're done, enjoy your bot!

FAQ

Q: I don't see my bot on my server!
A: Invite it by using this URL: https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot
Remember to replace CLIENT_ID with your bot client ID

Q: There aren't that many commands here...
A: Yes, I will only provide a few commands to get you started, maybe adding more later.

Q: Why the beer with the discord logo?
A: Because the framework is made so simple that even a drunk guy can set it up.

Optional tools

Flake8

Flake8 is a tool that helps you keep your code clean. Most coding softwares will have a plugin that supports this Python module so it can be integrated with your IDE. To install it, simply do pip install flake8. If you're using python 3.7, install by doing pip install -e git+https://gitlab.com/pycqa/flake8#egg=flake8

PM2

PM2 is an alternative script provided by NodeJS, which will reboot your bot whenever it crashes and keep it up with a nice status. You can install it by doing npm install -g pm2 and you should be done. Keep in mind that this PM2 file is made to work on my own Linux instance, you might need to change the interpreter value.

# Start the bot
pm2 start pm2.json

# Tips on common commands
pm2 <command> [name]
  start discord_bot.py    Run the bot again if it's offline
  list                    Get a full list of all available services
  stop discord_bot.py     Stop the bot
  reboot discord_bot.py   Reboot the bot

Docker

Docker is an alternative to run the bot 24/7 and always reboot again whenever it crashed. You can find the install manual here. You don't have to get it, but if you're used to having Docker, it's available at least.

# Build and run the Dockerfile
docker-compose up -d --build

# Tips on common commands
docker-compose <command>
  ps      Check if bot is online or not (list)
  down    Shut down the bot
  reboot  Reboot the bot without shutting it down or rebuilding
  logs    Check the logs made by the bot.

More Repositories

1

GiveMeBadge

Pretty simple Discord bot to get the active developer badge
Python
476
star
2

neofetch-win

πŸ–ΌοΈ neofetch, but for Windows
Python
97
star
3

CoffeeAPI

β˜• An API that provides random coffee images
Python
92
star
4

Modesta

🎨 A clean CSS framework made to be dark, responsive and easy to build with.
SCSS
82
star
5

alexflipnote.github.io

πŸ“ My own personal homepage to show my capability of HTML, CSS and JavaScript
HTML
68
star
6

Discord_Theme

🎨 A discord theme that changes your CSS style
SCSS
68
star
7

TypingTest

How fast can you type? Find out today with a typing test
JavaScript
27
star
8

ukraine_discord

A script that gets the news from liveuamap.com to post is on Discord as a webhook
Python
27
star
9

alex_api_archive

Archive of the image generator stuff from my API
Python
24
star
10

OsuKeyboard

A nice little software that simulates the typing sound from Osu!
Python
16
star
11

url_regex

Regular expression for matching URLs in Python
Python
12
star
12

MacroMaker

Easy to use macro software for Windows that works with .txt files to function.
Python
10
star
13

diskspace

Making it possible to use Linux df & du command on Windows/Linux.
Python
8
star
14

AlexEmoji

A CSS framework that provides my cute Alex emojis anywhere
SCSS
7
star
15

Dark_Typora

A nice and dark theme for Typora
CSS
5
star
16

discord_events

Custom bot I've made to host events on my personal Discord server.
Python
5
star
17

verify_steamid

The solution to combine your Discord account with your Steam account
Python
5
star
18

Brawlhalla.py

A Brawlhalla Discord bot that keeps track of your Brawlhalla stats.
Python
4
star
19

bulkrename

Rename multiple files in a folder to random characters
Python
4
star
20

blog.alexflipnote.dev

My personal blog, because reasons lol.
HTML
4
star
21

pug_watcher.py

Simple command-line Pug watcher/compiler made in Python
Python
4
star
22

playground

A collection of small websites I built when I was bored
HTML
3
star
23

festive.community

Bringing back memories of Festive Community
HTML
3
star
24

Sythe.py

A script that interacts with the Sythe website using Chrome drivers
Python
3
star
25

AmazonPollyTTS

The TTS API that xelA will probably use
Python
3
star
26

AlexFlipnote

My own bio I guess...?
3
star
27

jinja2_static

Using jinja2 engine to generate static files
Python
3
star
28

discord_bot.http

🍺 A simple discord bot that helps you getting started within discord.http
Python
2
star
29

json_html

Python code that translates JSON template to HTML
Python
1
star
30

ahk_archive

My archive of ahk scripts I made
AutoHotkey
1
star
31

PyCord_RAMDebug

Python
1
star