This bot checks the user's username on joining a guild, or changing the username in the guild. If the username is inappropriate, the user will be muted, kicked or banned. The bot is written in TypeScript.
Install Node.js:
Postgresql setup:
TypeScript Setup:
-
Open your command line
-
Let's install TypeScript:
# if you're on linux or mac you'll need to use sudo
npm i --global typescript @types/node
note: @types/node is the type safety for Node.js, it's not something you really have to look into just make sure you install it
Clone the repo with:
git clone https://github.com/NewCircuit/username-filter.git
Populate the config.json file in the config directory (fields after the :):
{
"db_host": "localhost",
"db_port": 8000,
"db_user": "db_user",
"db_pass": "db_pass",
"db_name": "postgres",
"log_level": "debug",
"token" : "bot_token",
"prefix" : "-",
"guild_id": "guild_id",
"automod_ch_id": "automod_ch_id",
"punishment_ch_id": "punishment_ch_id",
"mute_role_ids": {
"muted_id": "muted_id"
},
"discord_mod_role_ids": [
"discord_mod_role_id1",
"discord_mod_role_id2",
...,
"discord_mod_role_idn",
],
"selected_member_role_ids": [
"selected_member_role_id1",
"selected_member_role_id2",
...,
"selected_member_role_idn",
]
}
note: all data except "db_port" value has to be a value between the quotes ("") as shown in the example
Get all needed dependencies:
npm install
Run following command to build project:
tsc
After the project has been built run it with:
node .\build\bot.js
note: POSTGRES database needs to be up and running for the application to work.