A discord.py bot template with easy deployment through Github Actions

Overview

discord.py bot template

A discord.py bot template with easy deployment through Github Actions. You can use this template to just run a Python instance, Docker image, or Docker compose with other microservices. This is why it features a mockup API aswell, to showcase the flexibility of it.

Registering a new bot

Go to Discord Developer Applications Portal And create a new application. Then go to Bot -> Add Bot. Give it a name and the required permissions for your use case. Now use Click to Reveal Token to get your token, you will need this in configuration. Do not share this with anyone! If for some reason the token got leaked, you can regenerate a new one. This means you need to this this in the configuration later on aswell, so only do this when necessary.

Configuration

First you'll have to create a .env file. This is a file where all configuration is stored for this bot. If you are going to run this in a simple way locally, use the example.env file and fill in the field with your discord token. And save this with the file name only being: ".env" The script will now use this file to access the token.

Suggested: If you are planning to take the automated deployment approach, you will not need to put this key inside the .env file. Go to the Automated deployment pipeline section to set this up.

Running in docker

I'm going straight to running in docker. First you will have to build the docker image. You can do this by going inside the directory that contains the dockerfile and running the command:

docker build . -t 

To run the bot you can use:

docker run --env-file 
    
    

   

you can add the -d flag to run in detached mode. Even easier is using docker-compose. When working with different microservices this is must!

docker-compose -f 
   
     up --build

   

Use the --build flag if you've made changes. It won't rebuild every layer because it can use the cached one's, this means the whole process just takes a couple of seconds.

Automated deployment pipeline

First you'll have to generate a Personal Access Token. Keep a copy of this, you wont be able to access it once it's generated. You will put this key and the discord token inside the repository secrets under Settings -> Secrets -> Actions and create a new secret with the same key value pair. Now the tokens are accessible by Github Actions, but remain anonymous. Also other people with access to the repo can't see it, including yourself. From now on you're only able to write to these. Also add your user

image

Now set up a self-hosted runner. Ideally this is configured as a service so that it runs permanently and launches on startup. You can add a runner by going to Settings -> Actions -> Runners and add a new one. Follow the instructions for your platform. For this example I did it in my WSL Debian. Make sure docker is installed on this machine when running the action runner.

image

When starting the runner you should see the it appear with the idle status. I recommend this doc to get it up and running as a service. If you want to just quickly run it using the run.sh script, make sure that your user has the right privileges to do this. Check out this post if you encounter an error due to this problem.

image

Now Github Actions will use this machine to deploy the bot.

Owner
Thomas Van Iseghem
I create code and stuff...
Thomas Van Iseghem
A simple but useful Discord Selfbot with essential features, made with discord.py-self.

Discord Selfbot Xyno Discord Selfbot Xyno is a simple but useful selfbot for Discord. It has currently limited useful features but it will be updated

Amit Pathak 7 Apr 24, 2022
Python functions to run WASS stereo wave processing executables, and load and post process WASS output files.

wass-pyfuns Python functions to run the WASS stereo wave processing executables, and load and post process the WASS output files. General WASS (Waves

Mika Malila 3 May 13, 2022
Discord group chat spammer concept.

GC Spammer [Concept] GC-Spammer for https://discord.com/ Warning: This is purely a concept. In the past the script worked, however, Discord ratelimite

Roover 3 Feb 28, 2022
A Twitter bot developed in Python using the Tweepy library and hosted in AWS.

Twitter Cameroon: @atangana_aron A Twitter bot developed in Python using the Tweepy library and hosted in AWS. https://twitter.com/atangana_aron Cost

1 Jan 30, 2022
A Discord token grabber written in Python3, with awesome obfuscation and anti-debug protection.

☣️ Plague ☣️ Plague is a Discord token grabber written in Python3, obfuscated with Kramer, protected from traffic analysers with Scarecrow and using t

Billy 125 Dec 20, 2022
Plataforma para atendimento a outras empresas que necessitam de atendimento técnico.

Plataforma para atendimento a outras empresas que necessitam de atendimento técnico. É possível que os usuarios de empresas parceiras registrem solici

Kelvin Alisson Cantarino 2 Jun 29, 2022
Modified Version of mega.py package for Pyrogram Bots

Pyro Mega.py Python library for the Mega.co.nz API, currently supporting: login uploading downloading deleting searching sharing renaming moving files

I'm Not A Bot #Left_TG 10 Aug 03, 2022
Implementation of the paper 'Sentence Bottleneck Autoencoders from Transformer Language Models'

Introduction This repository contains the code for the paper Sentence Bottleneck Autoencoders from Transformer Language Models by Ivan Montero, Nikola

Ivan Montero 14 Dec 28, 2022
Telegram bot for searching videos in your PDisk account by @AbirHasan2005

PDisk-Videos-Search A Telegram bot for searching videos in your PDisk account by @AbirHasan2005. Configs API_ID - Get from @TeleORG_Bot API_HASH - Get

Abir Hasan 39 Oct 21, 2022
Riffdog Terraform scanner - finding 'things' in the Real World (aka AWS) which Terraform didn't put there.

riffdog Riffdog Terraform / Reality scanner - finding 'things' in the Real World which Terraform didn't put there. This project works by firstly loadi

Riffdog 4 Mar 23, 2020
A pypi package that helps in generating discord bots.

A pypi package that helps in generating discord bots.

PineCode Corp 3 Nov 17, 2021
❤️A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules

Natsuki Based on Python Telegram Bot Contributors Video Tutorial: Complete guide on deploying @TheNatsukiBot's clone on Heroku. ☆ Video by Sadew Jayas

Pawan Theekshana 8 Oct 06, 2022
A Python module for communicating with the Twilio API and generating TwiML.

twilio-python The default branch name for this repository has been changed to main as of 07/27/2020. Documentation The documentation for the Twilio AP

Twilio 1.6k Jan 05, 2023
A Discord chat bot for the Tardsquad guild (Discord name for server).

Tardsquad Discord Bot A Discord chat bot for the Tardsquad guild (Discord name for server). Resouces Discord Developer Portal A general tutorial for a

Tardsquad Quality Code Inc. 4 Jul 26, 2022
scrape tiktok/douyin video list from specific user or keyword

get-tiktok-user-video-list scrape tiktok/douyin video list from specific user or keyword 以**https://www.douyin.com/user/MS4wLjABAAAAUpIowEL3ygUAahQB47

wanghaisheng 4 Jul 06, 2022
BiliBili-live-barrage-transceiver - A simple python program for sending and receiving barrage in bilibili live room

BiliBili-live-barrage-transceiver - A simple python program for sending and receiving barrage in bilibili live room

zeroy 2 Jan 18, 2022
A VCVideoPlayer Bot for Telegram made with 💞 By @ProErrorXD

VC Video Player How To Host ✨ Heroku Deploy ✨ The easiest way to deploy this Bot is via Heroku. Credit 🔥 |🇮🇳 Louis |🇮🇳 Sammy |🇮🇳 Blaze Marsha

丂ムᄊᄊƳ 95 May 17, 2022
Improved file host. Change of interface and storage: 15 GB available.

File hosting v2 Improved file host. Change of interface and storage: 15 GB available. This app now uses the Google API to store, view, and delete file

Sarusman 1 Jan 18, 2022
A python based Telegram Bot for Compressing Videos with negligible Quality change

𝕍𝕚𝕕𝕖𝕠 ℂ𝕆𝕄ℙℝ𝔼𝕊𝕊𝕆ℝ 𝔹𝕆𝕋 ᴍᴜʟᴛɪғᴜɴᴄᴛɪᴏɴ ǫᴜᴀʟɪᴛʏ ᴄᴏᴍᴘʀᴇssᴏʀ A Telegram Video CompressorBot it compress videos with negligible Quality change.

Danish 154 Dec 04, 2022
Activate exitlag trial accounts

Exitlag Account Activator Activate exitlag trial accounts (unlimited trial accounts) ⭐ If you want to support me, follow me on github and star the pro

Benjamin 173 Nov 10, 2022