Skip to content

ruberVulpes/A-Discord-Bot

Repository files navigation

A Discord Bot Powered by Giphy

Python39 Tests CodeQL codecov Deploy

A Discord Bot is a Discord bot that uses Linear Regression Machine Learning model to help properly react to when a member of a discord server properly informs the other members of the server that it is time to play Overwatch.

If the message has an easily regexable or searchable text fragment it's checked first using regex, str.__contains__, or equality before falling back to the ML Model to help boost accuracy. Any message the ML Model is the sole source of flagging will be reacted to with the 🤖 emoji.

Example of the Bot

Motivation

The motivation of this bot was to have a bot that automatically responds with reactions on a message and posts a gif in response to a message containing multiple a's at the end of a message or a message that is only 'a'. These are both used in a Discord Server I am in to signal to the others that it is time to play Overwatch.

Also I kinda wanted to make a basic Discord Bot for fun.

Support Me

Help get me off Heroku free dynos

Dependencies

Dependency Installation

pip3 install -r requirements.txt

Environment Variables

DISCORD_TOKEN: The Bot's Discord Token
GIPHY_TOKEN: The Giphy API Token 
DATABASE_URL: [Optional] The URL to the database to store posting history to prevent spam. 
    Defaults to sqlite in memory if blank

How to Run

Pre-Requisites

  • A Discord App setup as a Bot

    • You'll need the following scopes for OAuth2
      • bot
        • Send Messages
        • Add Reactions
    • You can install the bot into a Discord Server via the OAuth2 generated URL
      • e.g. https://discord.com/api/oauth2/authorize?client_id=<1234>&permissions=2112&scope=bot
  • A Giphy API Key

  • Install the Dependencies

  • Set the Environment Variables

    • export DISCORD_TOKEN=xxxx
    • export GIPHY_TOKEN=xxxx

Running

  • python3 bot.py

Example

Example of the Bot

This is how we signal to each other that it's time to feed on Overwatch

Deployment

The bot is currently deployed on Heroku using free dynos.

The deployment is automated using the Deploy to Heroku Action from AkhileshNS.