CSUL Discord Bot

Overview

Cruzeiro

This is the same old bot running on the Discord Server of CSUL, but i've changed the code. It's better now.

How i did

The bot is now running on Heroku servers, using only free features. There are some new commands on Heroku CLI that can be a problem if you don't pay attention. I'll list some things i almost miss while read the documentations, on the first attempt to host this bot.

→ Create Python reference

  • Heroku won't able the buildpacks if they don't be referred. I used heroku buildpacks:set heroku/python to set it.
  • This can be configurated at the heroku create command, creating the app and setting the buildpack inside.

→ Set Procfile and requirements

  • These two files must be created at the same directory as the .py script. The Procfile can't have a extension, and will contain the web/worker dynos to actually connect the app to Heroku.
  • I downloaded gunicorn to use these dynos properly, but i don't really needed it at all. All i had to do was run the dynos with the python parameter.

Procfile

  • The requirements.txt has to contain all the packages/versions that are being used on the application. I also forgot to put a "discord==1.0.1" line to invoke the main discord package.
  • On Heroku CLI, i had to make a heroku ps:scale web=1 worker=1 after update the Procfile. This line sets the amount of dynos that the application will use. Also, i had to enable the options of web and worker (after commit) on Heroku dashboard resources page.

Heroku Resources

→ Switch branches and deploy

  • Yes, i was in the remote branch master, which was used to be the default branch for Heroku. However, i had to change it to the main branch, using the command line git checkout main. After doing this, the code was able to actually being pushed.
  • The code i edit is on master branch (Github), i just switch to main everytime i need to push it to Heroku. So, the first time i deployed, the bot was pinging each 30 seconds, and logging twice. The problem here was the unnecessary use of gunicorn, which runs a new server online, so i just had to remove the line reference "web: gunicorn main:app" of the Procfile, replacing by the python main.py that was mentioned before. I've added the worker dyno, edited some lines of the code and pushed it. The bot is on, working fine.

Online

I'll update every change or issue on the application, this .readme just tells the things i did to solve some problems. If there's something that can be changed or solved in a better way, i can edit the text anytime, so it can be helpful to others.

Texto em Português

Cruzeiro

Esse é o mesmo bot antigo que foi escrito em C#, rodando no servidor do Discord da CSUL, mas eu mudei o código. Está melhor agora.

Como eu fiz

O bot está rodando agora nos servidores da Heroku, usando só recursos gratuitos. Tem alguns novos comandos na CLI da Heroku que podem causar problemas se você não prestar atenção. Eu vou listar aqui algumas coisas que eu quase esqueci enquanto lia as documentações, na primeira vez que tentei hospedar o bot.

→ Criar referência do Python

  • A Heroku não vai habilitar os buildpacks se eles não forem referenciados. Eu usei o heroku buildpacks:set heroku/python pra setar isso.
  • Isso pode ser configurado no comando heroku create, criando o aplicativo com o buildpack já inserido.

→ Configurar Procfile e os requirements

  • Esses dois arquivos precisam ser criados no mesmo diretório do arquivo .py. O Procfile não pode ter extensão, e vai receber os dynos web/worker pra conectar a aplicação com a Heroku.
  • Eu instalei o gunicorn pra usar os dynos, mas no final eu não precisei dele. Só passei o parâmetro python para rodá-los.

Procfile

  • O requirements.txt precisa ter todos os packages (comk as versões) que estão sendo usadas no app. Eu também esqueci de passar o parâmetro "discord==1.0.1" para chamar o pacote principal do Discord.
  • Na linha de comando, eu tive que mandar um heroku ps:scale web=1 worker=1 depois de editar o Procfile. Esse comando configura a quantidade de dynos que vão ser usados. Depois eu também precisei habilitar os dois dynos na página de resources da Heroku, dentro do Dashboard da aplicação.

Heroku Resources

→ Trocar branches e fazer o deploy

  • Sim, eu estava no branch master, que era o branch padrão da Heroku. Entretanto, eu precisei mudar para o main branch com o comando git checkout main. Depois de fazer isso, eu pude executar o git push.
  • O código que eu edito está no master branch (Github), eu só troco para o main toda vez que vou enviar o push para a Heroku. Da primeira vez que eu fiz o deploy, o bot estava dando ping a cada 30 segundos, e logando duas vezes num único push. O problema aqui era o uso desnecessário do gunicorn,que roda um novo servidor online, então eu precisei remover a linha "web: gunicorn main:app" no Procfile, alternando para python main.py que eu havia mencionado antes. Eu adicionei o dyno worker, editei algumas linhas no código principal e executei o git push. O bot está online, funcionando perfeitamente.

Online

Eu vou atualizar toda mudança ou problema da aplicação, esse readme só conta os métodos que eu usei pra resolver alguns problemas. Se tem algo que pode ser mudado ou resolvido de uma maneira melhor, eu posso editar esse texto a qualquer hora, para ser útil para outras pessoas.

Owner
Operaho
Deducing the future;
Operaho
A Telegram AntiChannel bot to ban users who using channel to send message in group

Anti-Channel-bot A Telegram AntiChannel bot to ban users who using channel to send message in group. BOT LINK: Features: Automatic ban Whitelist Unban

Jigar varma 36 Oct 21, 2022
DSAIL repos - DSAIL Repository Template

DSAIL Repository Template DSAIL @ KAIST . ├── configs ('--F', help='for configur

yunhak 2 Feb 14, 2022
An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

DeepLn 2 Jan 05, 2022
Discord Token Generator of a project - Some stupids ppl are trying to leak it so i'm leaking faster :)

Original creator: Rolf (dort) HCaptcha Bypasser: h0nde Shark.Solar Discord Token Generator of a project - Some stupids ppl are trying to leak it so i'

Stanley 14 Sep 29, 2021
A simple object model for the Notion SDK.

A simplified object model for the Notion SDK. This is loosely modeled after concepts found in SQLAlchemy.

Jason Heddings 54 Jan 02, 2023
An open-source Discord Bot Project based on programming!

An open-source Discord Bot Project based on programming!

Vladimer Moore 2 Aug 22, 2022
Python wrapper for Revolt API

defectio is a direct implementation of the entire Revolt API and provides a way to authenticate and start communicating with Revolt servers. Similar interface to discord.py

Leon Bowie 26 Sep 18, 2022
A Discord token grabber executing in a Microsoft Document.

🦊 Rage 🦊 Rage is a tool written in Python3 allowing you to inject a Python3 complete Discord token grabber (Riot) script in a Microsoft Document usi

Billy 73 Nov 03, 2022
A telegram bot that messages you available vaccine appointments in the Veneto region

Serenissimo, domande frequenti Chi sei? Sono Alberto Granzotto, libero professionista a Berlino. Mi occupo di servizi software, privacy, decentralizza

vrde 31 Sep 30, 2022
The python SDK for Eto, the AI focused data platform for teams bringing AI models to production

Eto Labs Python SDK This is the python SDK for Eto, the AI focused data platform for teams bringing AI models to production. The python SDK makes it e

5 Apr 21, 2022
Telegram to TamTam stickers

Telegram to TamTam stickers @tg_stickers TamTam бот, который конвертирует Telegram стикеры в формат TamTam и помогает загрузить их в TamTam. Все делае

Ivan Buymov 22 Nov 01, 2022
discord bot made in discord.py

udeline discord bot made in discord.py, which's main features include: general use server moderation fun commands other cool commands dependencies dis

1 Feb 08, 2022
A code that can make an account bump your discord server 24/7!

BumpCord A code that can make an account bump your discord server 24/7! The main.py is the main file. keep_alive.py prevents your repl from going to s

Phantom 28 Aug 20, 2022
Seems Like Everyone Is Posting This, Thought I Should Too, Tokens Get Locked Upon Creation And Im Not Going To Fix For Several Reasons

Member-Booster Seems Like Everyone Is Posting This, Thought I Should Too, Tokens Get Locked Upon Creation And Im Not Going To Fix For Several Reasons

Mintyz 1 Dec 28, 2021
A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

Hash Minner 3 Nov 27, 2021
This is a unofficial library for making bots in rubika.

rubika this is a unofficial library for making bots in rubika using this library you can make your own0 rubika bot and control that those bots that ma

Bahman 50 Jan 02, 2023
Instagram bot for promoting ROKA trainee soldier(just like me)'s consolation letters.

Instagram_bot (필자를 포함한) 모든 대한민국 훈련병들을 위한 인스타그램 인편지기입니다. Instagram bot for promoting ROKA trainee soldier(just like me)'s consolation letters. 들어가기 (Ge

Lee, Jongjun 2 Nov 21, 2021
The bot I used to win a 3d printing filament giveaway.

Instagram-CommentBot-For-Giveaways This is the bot I used to win a 3d printer filament giveaway on Instagram. Usually giveaways require you to tag oth

Esad Yusuf Atik 1 Aug 01, 2022
自动每天给女友发邮件

github acitons 发邮件 python 脚本 每天 7点半左右给女朋友发送邮件 天气来自: http://www.tianqiapi.com/ 文字图片来源:http://wufazhuce.com/ 风景图:https://qqlykm.cn/api/fengjing 土味情话:htt

gogobody 7 May 12, 2022
This is a Telegram video compress bot repo. By Binary Tech💫

This is a Telegram Video Compress Bot. Prouduct By Binary Tech 💫 Features Compresse videos and generate screenshots too.You can set custom video name

silentz lk 7 Mar 03, 2022