πŸ“ˆ 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.

You might also like...
Some random bot for Discord which was created just for fun (Made with Discord.py library)
Some random bot for Discord which was created just for fun (Made with Discord.py library)

Ghosty Previously known as 'secondthunder-py-bot' This is repository of some random bot for Discord which was created just for fun and for some educat

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

Picot - A discord bot made to fetch images from Pexels and unsplash API and provide raw images directly in channels

Picot A discord bot made to fetch images from Pexels and unsplash API and provid

A simple bot that lives in your Telegram group, logging messages to a Postgresql database and serving statistical tables and plots to users as Telegram messages.
A simple bot that lives in your Telegram group, logging messages to a Postgresql database and serving statistical tables and plots to users as Telegram messages.

telegram-stats-bot Telegram-stats-bot is a simple bot that lives in your Telegram group, logging messages to a Postgresql database and serving statist

This is Pdisk Upload Bot made using Python with Pyrogram Framework. Its capable of uploading direct download link with thumbnail or without thumbnail & with Title Support.

Pdisk-Upload-Bot Introduction This Is PDisk Upload Bot Used To Upload Direct Link To Pdisk With Thumb Support Deploy Heroku Deploy Local Deploy pip in

It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.
It's a Discord bot to control your PC using your Discord Channel or using Reco: Discord PC Remote Controller App.

Reco PC Server Reco PC Server is a cross platform PC Controller Discord Bot which is a modified and improved version of Chimera for Reco-Discord PC Re

Discord bot script for sending multiple media files to a discord channel according to discord limitations.

Discord Bulk Image Sending Bot Send bulk images to Discord channel. This is a bot script that will allow you to send multiple images to Discord channe

Discord Auto bumper made in python, just a simple auto bumper that I made.

Discord Auto bumper made in python, just a simple auto bumper that I made.

πŸš€ An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase πŸ“Œ Links |Join the discord

Owner
Angelo-F
Dev @axyl-os
Angelo-F
A compatability shim between Discord.py and Hikari.

Usage as a partial shim: import discord import hikari import hikari_shim dpy_bot = discord.Client(intents=discord.Intents.all(), enable_debug_events=

EXPLOSION 3 Dec 25, 2021
A hyper-user friendly bot framework built on hikari

Framework A hyper-user friendly bot framework built on hikari. Framework is based off the blocking discord library disco, In both modularity and struc

Vincent 1 Jan 10, 2022
Telegram PHub Bot using ARQ Api and Pyrogram. This Bot can Download and Send PHub HQ videos in Telegram using ARQ API.

Tg_PHub_Bot Telegram PHub Bot using ARQ Api and Pyrogram. This Bot can Download and Send PHub HQ videos in Telegram using ARQ API. OS Support All linu

TheProgrammerCat 13 Oct 21, 2022
Zendesk Ticket Viewer is a lightweight commandline client for fetching and displaying tickets from a Zendesk account provided by the user

Zendesk Ticket Viewer is a lightweight commandline client for fetching and displaying tickets from a Zendesk account provided by the user.

Parthesh Soni 1 Jan 24, 2022
Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

ThΓ©o 2 Sep 15, 2022
A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create custom messages by telling the bot with Commands.

A discord Server Bot made with Python, This bot helps people feel better by inspiring them with motivational quotes or by responding with a great message, also the users of the server can create custom messages by telling the bot with Commands.

Aran 1 Oct 13, 2021
Barbot is a discord bot made from discord.py and python, barbot is most to fun and roleplay for servers!

BarBot Main source of barbot Overview Barbot is a discord bot made from discord.py and python, barbot is most to fun and roleplay for servers! Links i

AlexyDaCoder 3 Nov 28, 2021
DeKrypt 24 Sep 21, 2022
Crystal Orb is a discord bot made from discord.py and python

Crystal orb Replacing barbot Overview Crystal Orb is a discord bot made from discord.py and python, Crystal Orb is for anti alt detection and other st

AlexyDaCoder 3 Nov 28, 2021
A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py)

Articuno (discord-interactions) A small and fun Discord Bot that is written in Python and discord-interactions (with discord.py) Get started If you wa

Blue 8 Dec 26, 2022