📈 A Discord bot for displaying the download stats of a repository made with Python, the Hikari API and PostgreSQL.

Overview

📈 axyl-stats

axyl-stats is a Discord bot made with Python (with the Hikari API wrapper) and PostgreSQL, used as a download counter for a GitHub repo.

This bot is used to check the download stats of a particular repo either with a bot command (.stats) or automatically in a set interval (TODO).

Setting up this bot is done through the .env environment variables.

Python Postgres Discord

Contents

Overview

Right now, the bot's functionality is like this:

axyl-stats image

Setting Up

Python 3.8 and above is required. PostgreSQL must also be installed, set up with a database and running. axyl-stats will take care of creating and managing the database table.

First, clone this repo:

git clone https://github.com/angelofallars/axyl-stats

Then, change directories into the repo and install the required dependencies:

cd axyl-stats
python3 -m pip install -r requirements.txt

In the same directory, make a .env file and put the bot token and repo info in there.

The environment variables that axyl-stats will use are:

axyl-stats.py

Required

  • BOT_TOKEN: The Discord bot's API token. Make a new Discord application in the Discord Dev Portal and create a bot for it. You will see the copyable token.
  • REPO_OWNER: The owner of the repo.
  • REPO_NAME: The name of the repo.
  • DB_NAME: The database to fetch data from.
    • You must create a database in PostgreSQL first with the name DB_NAME before you can run this app.
  • COUNTER_CHANNEL: The Discord channel(s) to send automated statistics to. Multiple channels are separated with a comma (,).

Optional

  • INTERVAL (default 60): The interval in minutes in which the bot will fetch the download stats.
  • DB_USER: The user logging into the DB.
  • DB_PASS: The DB password.
  • DB_HOST (default 127.0.0.1): The host IP address.
  • DB_PORT (default 5432): The port of the DB.

stats-database.py

To run the database testing, you must also put in the .env file:

Required

  • DB_NAME: Ditto.
  • REPO_OWNER: Ditto.
  • REPO_NAME: Ditto.

Optional

  • GITHUB_API_KEY: The GitHub API key for requesting data. If you don't have an API key, you'll be limited to 60 requests per hour.
  • DB_USER: Ditto.
  • DB_PASS: Ditto.
  • DB_HOST: Ditto.
  • DB_PORT: Ditto.
  • DB_UPDATE_INTERVAL (default 5): The interval (in minutes) to update the database.

.env example

.env file

BOT_TOKEN=<your token>
GITHUB_API_KEY=<api key>
REPO_OWNER=axyl-os
REPO_NAME=axyl-iso
INTERVAL=60
COUNTER_CHANNEL=axyl-statistics
DB_NAME=axyl-stats
DB_USER=archie
DB_PASS=hunter2

Running The Bot

To run the bot:

python3 axyl_stats.py

To run the backend that updates the database with info from the GitHub API:

python3 stats_database.py

Testing

To be able to unit test the bot, you must also specify a TEST_BOT_TOKEN in the .env file. (Tests not yet implemented)

License

This program is licensed under the GPLv3 License.

Owner
Angelo-F
Dev @axyl-os
Angelo-F
Python wrapper for CoWin API's

Cowin Tracker Python API wrapper for CoWin, India's digital platform launched by the government to help citizens register themselves for the vaccinati

Saiprasad Balasubramanian 43 Jun 11, 2022
Python library to interact with a Z-Wave JS server.

zwave-js-server-python Python library for communicating with zwave-js-server. Goal for this library is to replicate the structure and the events of Z-

Home Assistant Libraries 54 Dec 18, 2022
Discord bot for playing Werewolf game on League of Legends.

LoLWolf LoL人狼をプレイするときのDiscord用botです。 (Discord bot for playing Werewolf game on League of Legends.) 以下のボタンを押してbotをあなたのDiscordに招待することで誰でも簡単に使用することができます。

Hatsuka 4 Oct 18, 2021
iCloudPy is a simple iCloud webservices wrapper library written in Python

iCloudPy 🤟 Please star this repository if you end up using the library. It will help me continue supporting this product. 🙏 iCloudPy is a simple iCl

Mandar Patil 49 Dec 26, 2022
A multi purpose discord bot for python

Sypher The best multi purpose discord bot. Add Sypher right now Invite Me | Join

Johan Naizu 1 Dec 15, 2022
A Django-style ORM idea for manipulating Google Datastore entities

No SeiQueLa ORM EM DESENVOLVIMENTO Uma ideia de ORM no estilo do Django para manipular entidades do Google Datastore. Montando seu modelo: from noseiq

Geraldo Castro 16 Nov 01, 2022
Telegram bot to scrape images from the reddit universe

Telegram bot to scrape images from the reddit universe

XD22 3 Sep 30, 2022
Automate HoYoLAB Genshin Daily Check-In Using Github Actions

Genshin Daily Check-In 🤖 Automate HoYoLAB Daily Check-In Using Github Actions KOR, ENG Instructions Fork the repository Go to Settings - Secrets Cli

Leo Kim 41 Jun 24, 2022
📷 Instagram Bot - Tool for automated Instagram interactions

InstaPy Tooling that automates your social media interactions to “farm” Likes, Comments, and Followers on Instagram Implemented in Python using the Se

Tim Großmann 13.5k Dec 01, 2021
Esse script procura qualquer, dados que você queira na wikipedia! Em breve traremos um com dados em toda a internet.

Buscador de dados simples Dependências necessárias Para você poder começar a utilizar esta ferramenta, você vai precisar da dependência "wikipedia", p

Erick Campoy 4 Feb 24, 2022
A simple Telegram bot that can add caption to any media on your channel

Channel Auto Caption This bot can add a caption for any media/document sent to a channel. Just deploy bot and add bot as admin to a channel. Deploy to

22 Nov 14, 2022
A Telegram bot for Download songs in mp3 format from YouTube and Extract lyrics from Genius.com ❤️

MeudsaMusic A Telegram bot for Download songs in mp3 format from YouTube and Extract lyrics from Genius.com ❤️ Commands Reach @MedusaMusic on Telegram

Bibee 14 Oct 06, 2022
=>|<= the MsgRoom bot for Windows 96

=|= bot A MsgRoom bot in Python 3 for Windows96.net. The bot joins as =|=, if parameter name_lasts is not true and default_name is =|=. The full

Larry Holst 2 Jun 07, 2022
A python wrapper for interacting with the LabArchives API.

LabArchives API wrapper for Python A python wrapper for interacting with the LabArchives API. This very simple package makes it easier to make arbitra

Marek Cmero 3 Aug 01, 2022
ImaginaryTicketing is a simple ticketing system for running CTF Competitions on discord.

ImaginaryTicketing ImaginaryTicketing is a simple ticketing system for running CTF Competitions on discord. Be sure to checkout ImaginaryCTF. See docs

GudOreos 8 Jul 18, 2022
A Discord bot that controls Pico-8.

Pico-8 Discord Bot Synopsis: A Discord bot that controls Pico-8. Please let me know if you make any games with this tool! I will simplify the discord.

Camden 1 Jan 28, 2022
AWS Lambda Fast API starter application

AWS Lambda Fast API Fast API starter application compatible with API Gateway and Lambda Function. How to deploy it? Terraform AWS Lambda API is a reus

OBytes 6 Apr 20, 2022
Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Ali Hejazizo 12 Aug 14, 2022
This is a tool to help people to make a bot for labelling images for machine learning projects.

labeller_images_python_telegramBOT This is a bot to help collect data for any machine learning project. It was developed using the python-telegram-bot

Diego Silveira 2 Nov 13, 2021
A combination between python-flask, that fetch and send data from league client during champion select thanks to LCU

A combination between python-flask, that fetch data and send from league client during champion select thanks to LCU and compare picked champs to the gamesDataBase that we need to collect using my ot

Anas Hamrouni 1 Jan 19, 2022