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
.
Command interface: Notion page.
Automation: Notion page.
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
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
Go to discord.com/developers to create the bot:
- Create a new application
- 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.
Copy .env.template
file to .env
file and edit:
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.
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
On linux distros:
apt-get update
apt-get install redis-server
systemctl start redis-server
systemctl status redis-server
On windows, follow this guide.
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.
- To simply start LCHelper, just run:
python bot.py
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.
- 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.
- To learn more about discord.py: discordpy.readthedocs
- To learn more about sql in python: sqlalchemy
- The command does use both normal commands (prefix) and slash commands. Make sure you are familiar with command tree, slash commands and interaction:
- Just-in-case guidelines: python guide
Made with 🧡 by Lowie's Leetcode Community Bot Development Team.