Skip to content

Discord Bot built for LLC members to practice algorithms together as a community :D

License

Notifications You must be signed in to change notification settings

Lowie-s-Leetcode-Community/LCHelper

Repository files navigation

LCHelper

Repo for LLC Assistant bot - A Discord bot built for Lowie's LeetCode Community (LLC) and all other stuff.

The database currently in use is PostgreSQL, and the library wrapper for the bot is discord.py 2.0+.

Current release Python version: 3.10.12.

Features

Command interface: Notion page.

Automation: Notion page.

First-time Installation

1. Clone the repository

Clone the repo using GUI or command line:

  • If you have ssh set up: git clone git@github.com:Lowie-s-Leetcode-Community/LCHelper.git
  • If you don't: git clone https://github.com/Lowie-s-Leetcode-Community/LCHelper.git

2. Library

Make sure you have Python when running this: Run: pip install -r requirements.txt

psycopg2 installation is required, but has proven to be problematic on some machine. Please try running either:

pip install psycopg2

or

sudo apt-get install build-dep python3-psycopg2

3. Create an app in discord.com/developer

Go to discord.com/developers to create the bot:

Discord developer-home

  • Create a new application

Discord app info

  • In the OAuth2 part, save the Client secret somewhere for the section below.
  • In the Bot part, save the Token to use in the section below.

Note that both of these will only show up 1 time, if you want to get it again, it will generate a new one.

OAuth2 Instruction

4. Set up .env file

Copy .env.template file to .env file and edit:

alt text

  • BOT_TOKEN: the Token you get from discord.com/developer in the above section.
  • CLIENT_SECRET: the Client secret of the bot from discord.com/developer in the above section.
  • POSTGRESQL_CRED: change 12345678 to your postgres password, lc_db to the schema's name.
  • POSTGRESQL_SCHEMA: schema's name.
  • BOT_PREFIX: depends on you.

Leave the rest as it is.

5. Database

PostgresSQL

We'll set up the database using llc-webapp repo, using Prisma tool.

Clone the web app to somewhere else: llc-webapp Follow part 1, 2, 3 in README.md in llc-webapp to set up postgreSQL

Redis

On linux distros:

apt-get update
apt-get install redis-server
systemctl start redis-server
systemctl status redis-server

On windows, follow this guide.

6. Add your app as a bot into our server

Paste this URL into your browser:

https://discord.com/api/oauth2/authorize?client_id=<your-client-id>&permission=8&scope=bot%20applications.commands

Replace <your-client-id> with your bot's client ID.

7. Run the bot

  • To simply start LCHelper, just run:
python bot.py

8. Sync commands (Use when installing, or a new command is implemented)

Type into the #bot-commands channel:

<bot-prefix>sync 1

Replace <bot-prefix> with your prefix of choice.

Example: if you've set BOT_PREFIX as ?!?, you should type ?!?sync 1 into the #bot_commands server.

sync

Notes

  • Please come up with your own BOT_PREFIX in case of many devs working at the same time.
  • Please use /set_logging to the dedicated channel for bot-dev logging. The default channel is public.

Documentations

License

MIT

Made with 🧡 by Lowie's Leetcode Community Bot Development Team.

About

Discord Bot built for LLC members to practice algorithms together as a community :D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages