๐Ÿ“ˆ 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
A Telegram Bot To Stream Videos in Telegram Voice Chat.

Video Stream X Bot Telegram bot project for streaming video on telegram video chat, powered by tgcalls and pyrogram Deploy to Heroku ๐Ÿ‘จโ€๐Ÿ”ง The easy wa

Mโทจoอฆnsอ›แด›โทฎeอคrอฌ Zeอคrอฌoอฆ 13 Dec 05, 2022
Riverside Rocks Python API

APIv2 Riverside Rocks Python API Routes GET / Get status of the API GET /api/v1/tor Get Tor metrics of RR family GET /api/v1/metrics Get bandwidth

3 Dec 20, 2021
A Python Module That Uses ANN To Predict A Stocks Price And Also Provides Accurate Technical Analysis With Many High Potential Implementations!

Stox โšก A Python Module For The Stock Market โšก A Module to predict the "close price" for the next day and give "technical analysis". It uses a Neural N

Dopevog 31 Dec 16, 2022
Discord bot for playing blindfold chess.

Albin Discord bot for playing blindfold chess written in Python. Albin takes the moves from chat and pushes them on the board without showing it. TODO

8 Oct 14, 2022
1.ๆœฌ้กน็›ฎ้‡‡็”จPython Flaskๆก†ๆžถๅผ€ๅ‘ๆไพ›(ๅบ”็”จ็ฎก็†,ๅฎžไพ‹็ฎก็†,Ansible็ฎก็†,LDAP็ฎก็†็ญ‰็›ธๅ…ณๅŠŸ่ƒฝ)

op-devops-api 1.ๆœฌ้กน็›ฎ้‡‡็”จPython Flaskๆก†ๆžถๅผ€ๅ‘ๆไพ›(ๅบ”็”จ็ฎก็†,ๅฎžไพ‹็ฎก็†,Ansible็ฎก็†,LDAP็ฎก็†็ญ‰็›ธๅ…ณๅŠŸ่ƒฝ) ๅŽ็ซฏ้กน็›ฎ้…ๅฅ—ๅ‰็ซฏ้กน็›ฎไธบ:op-devops-ui jenkinsManager ไธ€.ๆ’ไปถpython-jenkins bugไฟฎๅค (1).ๆ’ไปถ็‰ˆๆœฌ pyt

3 Nov 12, 2021
DeleteAllBot - Telegram bot to delete all messages in a group

Delete All Bot A star โญ from you means a lot to me ! Telegram bot to delete all

Stark Bots 15 Dec 26, 2022
BLYRIC is a Twitter bot that tweets a song lyric every night.

BLYRIC BLYRIC, a bot that tweets a song lyric every night. Follow on Twitter: @blyric_ Overview BLYRIC is a Twitter bot that tweets a song quote every

Bruno Kenzo Hyodo 6 Oct 05, 2022
This discord bot will help you to control your target through PickleC2

PickleC2-Bot This discord bot will help you to control your target through PickleC2 WHAT's a PickleC2? PickleC2 is a simple C2 framework written in py

4 Jun 25, 2022
Hydrathallies'in istegi uzerine yapildi :)

Telegram-Doviz-Bot Telegram Dรถviz Botu, Pyrogram ile yapฤฑldฤฑ. Deploy Deploy on Heroku Deploy on local git clone https://github.com/lambda-stock/Telegr

2 Dec 08, 2021
A Python script to update Spotify Playlist data every 5 minutes.

Spotify Playlist Updater A Python script to update Spotify Playlist data every 5 minutes. Description An automatic playlist updater using Spotify API

6 Nov 24, 2022
An instagram bot developed in Python with Selenium that helps you get more Instagram followers.

instabot An instagram bot developed in Python with Selenium that helps you get more Instagram followers. Install Youโ€™ll need to have: Python Selenium

65 Nov 22, 2022
Script for polybar to display and control media(not only Spotify) using DBus.

polybar-now-playing Script for polybar to display and control media(not only Spotify) using DBus Python script to display and control current playing

Dope Wizard 48 Dec 31, 2022
Twitter feed of newly published articles in Limnology

limnopapers Code to monitor limnology RSS feeds and tweet new articles. Scope The keywords and journal choices herein aim to focus on limnology (the s

7 Dec 20, 2022
A Python library for the Discourse API

pydiscourse A Python library for working with Discourse. This is a fork of the original Tindie version. It was forked to include fixes, additional fun

Ben Lopatin 72 Oct 14, 2022
Reads and prints information from the website MalAPI.io

MalAPIReader Reads and prints information from the website MalAPI.io optional arguments:

Squiblydoo 16 Nov 10, 2022
Running Performance Calculator

Running Performance Calculator ๐Ÿ‘‰ Have you ever wondered if you ran 10km at 2000

Davide Liu 6 Oct 26, 2022
Code for paper "Adversarial score matching and improved sampling for image generation"

Adversarial score matching and improved sampling for image generation This repo contains the official implementation for the ICLR 2021 paper Adversari

Alexia Jolicoeur-Martineau 114 Dec 11, 2022
Touca SDK for Python

Touca SDK For Python Touca helps you understand the true impact of your day to day code changes on the behavior and performance of your overall softwa

Touca 12 May 18, 2022