Skip to content

IQisMySenpai/RedditTopOfBot

Repository files navigation

RedditTopOfBot

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact
  7. Acknowledgements

About The Project

So basically we needed a discord bot that fetches the top post of the week from a given subreddit every week.

While we were programming it, we thought why not make it "potent", which resulted in a fully working, multiserver bot.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Requirements

You should already have installed python and create a discord bot with the token on hand/ready to paste. A MongoDB database is also required.

Installation

  1. Clone the repo
    git clone https://github.com/IQisMySenpai/RedditTopOfBot.git
  2. Create a token file
    cd 'Your repo location'
    touch secret.py
    nano secret.py
  3. Put in your: token, db username, db password, db name, queue collection name, server collection name Then save and exit. Example of the content of the secret.py file. Make sure not to add this file to your git, since your token etc. is a secret.
    TOKEN = "KSciUF702bY3brOci1E9BG24Yz0KnBS1jc30aQUw"
    db_username = "bot_user"
    db_password = r"dZnep2emk6Sin7PMAj2Hfrb27zFvyw"
    db_name = "TopOfBot"
    col_queue = "queue"
    col_servers = "servers"
    

Hosting

We are using MongoDB Atlas for hosting the db. If you are hosting it yourself you might need to change the client link in mongo_api.

Heroku is our current host for the bot. You will need to generate a Procfile for controlling the bot.py

Usage

For running the bot simply run:

python3 bot.py

Commands for RedditTopOf:

  • changePrefix [prefix]
    Changes the prefix that is used in front of command.
    [prefix] can be any text/character
  • getImage [subreddit] [topOfTime]
    Fetches the top post of the given time span
    [subreddit] is the subreddit you want. Can be r/name or just name.
    [topOfTime] needs to be one of ('hour', 'day', 'week', 'month', 'year', 'all').
  • addInterval [subreddit] [topOfTime] [hours] [startTime]
    Fetches the top post of the given time span every given hour
    [subreddit] is the subreddit you want. Can be r/name or just name.
    [topOfTime] needs to be one of ('hour', 'day', 'week', 'month', 'year', 'all').
    [hours] how long the bot waits before sending another post. Minimum is 0.25.
    [startTime] (optional) starts the Interval at a given time hh:mm. 24h format; Zero-padded (02:05); 24:00 is invalid. UTC timezone.
  • listIntervals
    Lists all your Intervals
  • deleteInterval [name]
    Deletes a interval of guild
    [name] of Interval (or * for all)
  • help
    Prints Commands
  • option [name] [value] (Admin Only) Set server options. [name] Name of the option [value] Value of the option Options: NSFW [true/false] Show NSFW content changePrefix [text/character] Changes the prefix that is used in front of command
  • fuckYou
    Insult the bot for a funny reaction
  • version
    Prints Version

Roadmap

Maybe if we are bothered we might integrate timezones, but currently we don't a F, since everything works :D Or we could add Video, Text and Gallery Support.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Project Link: https://github.com/IQisMySenpai/RedditTopOfBot Developer Server Link: https://discord.gg/UAxANEUfhN

Acknowledgements

Did 50% of the coding with 'Code with me' in PyCharm

About

Discord Bot that Prints the Top of ___ from a subreddit in a given interval

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages