Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c336c8e
added better help command. general cleanup.
Jul 31, 2019
416ede0
Merge branch 'master' into 'dev'
Jul 31, 2019
642e6cc
Add simple version command
Aug 1, 2019
980068a
Merge branch 'dev' of https://gitlab.com/true-colors/automod into dev
Aug 1, 2019
cdb05ea
reintegrate heroku, remove glitch.
Sep 6, 2019
9f4de1a
small changes.
Sep 12, 2019
8ed80a6
link: create main gameapi and webserver. upgraded database structure …
Jan 12, 2020
151fe36
readme: add quote from project proposal
Jan 12, 2020
1c80caa
0.4.0: Dynamic Settings Loader
Jan 18, 2020
f9bc289
db: Update default patch_notes
Jan 18, 2020
453b71c
legacy: initial new integration. edit settings loader with dynamic to…
Jan 25, 2020
0fedba7
Merge branch 'dev' of https://gitlab.com/true-colors/link into dev
Jan 25, 2020
99d6b79
readme: update legacy
Jan 25, 2020
3ef5396
settings: create db json object "toggles," integrate into commands. b…
Jan 25, 2020
0ea2d48
settings: bug fixes
padlocks Jan 25, 2020
4958490
audits: create a audit log feature + bug fixes. added editAction comm…
padlocks Jan 26, 2020
2ffd880
general: bug fixes
padlocks Jan 27, 2020
d116628
addevidence: added alias "attach"
padlocks Jan 27, 2020
b175fa8
deleteLog: added command for HR members (#10)
padlocks Feb 1, 2020
d4f63d4
general: cease use of deprecated methods, update member names.
padlocks Feb 1, 2020
e59e819
legacy: small debug updates
padlocks Mar 14, 2020
ea48727
upgrade: major djs12 changes. still undergoing testing.
padlocks Mar 14, 2020
01bee7e
Revert "upgrade: major djs12 changes. still undergoing testing."
padlocks Mar 16, 2020
99ecfdb
cmds: added unban command
padlocks Mar 29, 2020
b95a575
settings: complete structure (#14)
padlocks Mar 29, 2020
f1989da
Merge branch 'dev' of https://gitlab.com/true-colors/link into dev
padlocks Mar 29, 2020
0673458
automod: revised auto-moderation system (#15)
padlocks Apr 13, 2020
ba514b9
hotswap: Allow hot-swapping of settings tables.
padlocks Apr 13, 2020
18c07b1
hotswap: sv and bug fixes. [ requires testing (#16) ]
padlocks May 18, 2020
1334cf3
adonis: add adonis admin to project
padlocks May 19, 2020
8f692cc
adonis: remove clown addition
padlocks May 19, 2020
53da45c
adonis: add onEvents for trello updating purposes
padlocks May 20, 2020
5dbaa2f
adonis: fix odd formatting error
padlocks May 20, 2020
8b8c06d
web: update web with sv get/post routes.
padlocks May 20, 2020
0b8c532
adonis: back-end LinkAPI creation. updated DefaultSettings
padlocks May 20, 2020
578af1b
adonis: LinkAPI.lua; add todo list
padlocks May 20, 2020
0716c3c
db: add "active" field in bans table. used only in-game.
padlocks May 20, 2020
cf675df
adonis: checks users on entry if banned; link integration.
padlocks May 20, 2020
16e92b2
adonis: prep for anti-bot protection
padlocks May 20, 2020
2c50437
web: bug fixes
padlocks May 20, 2020
a1938aa
adonis: quick changes.
padlocks May 21, 2020
830ddd8
adonis: bug fixes
padlocks May 21, 2020
e10ca35
production prep
padlocks May 21, 2020
a1685a2
db swap
padlocks May 21, 2020
668151a
web: bug fixes
padlocks May 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
.vscode/

# Database Files
tc.db
test.db

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

discord-logs.json
game-logs.json
discord-logs-1.json
game-logs-1.json

# Runtime data
pids
*.pid
Expand Down
14 changes: 14 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
stages:
- deploy

deploy_prod:
stage: deploy
script:
- echo "Deploy to production server"
- git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/tc-automod.git
- git push -fq heroku HEAD:master || true
environment:
name: production
when: manual
only:
- master
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
worker: node ./src/bot.js
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# AutoMod
tc needed a bot smh
# True Colors Link Service
A service which offers a simple link between ROBLOX services and Discord so all data and user information is united and easy to access. A product of the True Colors Development Team.

The initial goal of the LINK project was to create a more robust moderation system for TCA. The concepts and plans have changed since the initial unreleased project proposal from January 2018.
> LINK is the automation and simple interface of various tasks of the True Colors Administration. As the acronym describes, it links everything together into a single and easy to use interface through Discord bot commands and a website dedicated to the True Colors staff team. The network would branch into both the Discord and our ROBLOX game (Skylands) in order to unify our logging system into one place. The use of a bot connected to LINK would verify users and send potentially suspicious information to the staff team to investigate while also connecting Discord accounts to ROBLOX accounts making it easy for the administration to connect users and their actions from both Discord and the group games.
The website would include an improved appeal system which not only logs all appeals into a single place, but also helps keep the staff team focused on investigating the user using a Discord bot to message notifications, in #administration-chat and / or DMs, and website notifications. The entire goal of this project is to help create a more focused and structured administrative system.
-- *TCA LINK Project Proposal, September 1, 2018, Pascal Young*

After such a long wait, a lot of disscussion, unimaginable amounts of time and energy, the project is afloat and will be released Q1 of 2020 in the main True Colors group games. It may have taken 2 years, but for the product's success, this time has given us plenty of quality assurance tests and logistical problem solving time.

- atom#0001

## Setup
Setting up this project for production is fairly straight-forward, if you know about the system in place. There are "automatic" moderation systems in place, which are toggleable. However, if you are unsure about any random numbers in the config file, it may be best to leave it alone.

**As of January 18, 2020**: a more elegant configuration system has been created allowing for dynamic config file changes. All configuration values have been moved to the database file under the settings table. *Changing values will require a database browser for SQLite files*.

Requirements:
- Discord Bot Token
- Rules and startup dedicated channels.
- A dedicated VPS (Virtual Private Server) for the Game Interface.
- A game.

The hardest part of all of this is the VPS. Make sure you port forward the port "5000". Any operating system could be used, Linux was the only testing candidate though.

## How It Works
### Discord Interface
We use a discord bot to serve data to the admin upon request. Since Discord is our main method of communication, this is concidered a central line. Previously using Trello, manual logging Discord channels, and having a group game, everything is easily accessable via Discord commands, including logs created from the game.

### Game Interface
The game interface is a bit more complex than the others. The game interacts with a web API with the included server. An in-game script holds both a ViewKey (for GET requests) and a PostKey (for POST requests.) Data is served to the gameserver to the admin client from the webserver. While the interface isn't as polished due to the existing game UI, the main features are satisfactory with logging and adding evidence and such.

### Export Service
Automated scripts can only do so much, as it doesn't account for human error. While there are scripts included in the source code to help export previous logs from Trello and Discord, some logs will need to be manually entered. At the time of writing this, there are 2600 logs on Discord. Plans to save logs which aren't able to be automatically saved to the database to a file are in the works. This feature has began development January 25, 2020. Expect updates soon.
20 changes: 13 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"name": "tc-auto-mod",
"version": "0.0.0",
"name": "tc-link",
"version": "1.0.0",
"description": "",
"engines": {
"node": "12.0.0"
"node": "12.6.0"
},
"dependencies": {
"anyid": "^1.0.1",
"babel-eslint": "^8.1.2",
"better-sqlite3": "^5.4.0",
"body-parser": "^1.19.0",
"chalk": "^2.0.1",
"cheerio": "^1.0.0-rc.2",
"discord.js": "^11.2.1",
"discord.js-commando": "^0.9.0",
"discord.js": "^11.6.3",
"discord.js-commando": "^0.10.0",
"eslint": "^4.14.0",
"express": "^4.17.1",
"flatted": "^2.0.1",
Expand All @@ -35,10 +36,15 @@
"scripts": {
"start": "node ./src/bot.js",
"fill": "node ./scripts/filldb.js",
"init": "node ./scripts/initdb.js"
"init": "node ./scripts/initdb.js",
"web": "node ./src/web/Server.js",
"gen-legacy-chat": "node ./scripts/legacy/discord.js",
"gen-legacy-game": "node ./scripts/legacy/game.js",
"convert-legacy-chat": "node ./scripts/legacy/discordConvert.js",
"convert-legacy-game": "node ./scripts/legacy/gameConvert.js"
},
"author": "Pascal Young",
"private": true,
"main": "bot.js",
"repository": "https://gitlab.com/true-colors/automod.git"
"repository": "https://gitlab.com/true-colors/link.git"
}
79 changes: 78 additions & 1 deletion scripts/filldb.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
/*
* v2.0 filldb.js. Adds more static data.

* No breaking changes besides new tables.
*/

var sqlite = require('sqlite3')
var db = new sqlite.Database('tc.db')

var reasons = [
/*
? Reason entries:
? { reason: "", value: 0 },
*/

// General
{ reason: "exploit", value: 999 },
{ reason: "iplogger", value: 999 },
Expand Down Expand Up @@ -41,10 +52,76 @@ var reasons = [
{ reason: "dmhatespeech", value: 5 },
]

var staff = [
/*
? Staff entries:
? { igid: "", name: "", ign: "", chat_id: "", username: "", role: "",
? warn_credit: 0, kick_credit: 0, ban_credit: 0 }
*/


// Testing purposes, not all staff entries..
{ igid: "000", name: "Audrey", ign: "pascaling", chat_id: "276126275083436034", username: "atom#0001", role: "Head Discord Moderator",
warn_credit: 100, kick_credit: 100, ban_credit: 100 }
]

// defaultSettings
var s = {
experiments: 0,
owner: '276126275083436034',
prefix: '!',
token: '',
log_channel: '',
startup_channel: '',
rules_channel: '',
default_tz: 'UTC',
timezone: 'UTC/GMT',
WEBKEY: '',
POSTKEY: '',
auto_moderate: 0,
lowKick1Points: 6,
lowBan1Points: 10,
lowKick2Points: 16,
lowBan2Points: 22,
lowKick3Points: 28,
lowPermPoints: 34,
version: '0.5.0',
rules: "**1.** Do not spam. Spam is considered repeatedly sending images, posting lengthy and irrelevant message, posting long strings of messages (i.e. song lyrics, emoji spam), spam pinging (@ing) people/ranks, etc.\n\n**2.** Do not advertise other servers or groups without permission. This includes direct messaging members of this server advertisements without their consent.\n\n**3.** Inappropriate language, topics, and actions are not allowed. this includes:\n→**A.** Slurs, deliberate attempts to revoke negative reactions, pornography/adult conent, gore, offensive/hateful content in regards to race, gender identity, sexuality, etc., and graphic topics such as major genocides and school shootings.\n→**B.** Please refrain from making insensitive jokes, i.e. trigger jokes, insulting people by calling them 'autistic', etc.\n\n**4.** Do not post harmful content such as viruses, the glorification of harmful acts (i.e. self-harm, suicide), threats of IP tracking/DDoSing/Doxing, and malicious/illegal material.\n\n**5.** Respect and common decency is expected at all times. Do not mock, harass, or bully other members; this includes intentionally making people uncomfortable.\n\n**6.** Please do not be intentionally obnoxious, particularly in the voice channels. This includes playing loud audio, screaming, mic spamming, etc.\n\n**7.** True Colors is not an online dating platform; do not utilize the server as a platform for dating and/or hookups.\n\n**8.** Do not publicly post about moderation history. If you have a problem regarding moderation, please contact a member of the staff team.\n\nFor ROBLOX-related rules and an in-depth version of the guidelines, click [here](https://docs.google.com/document/d/1g1uASD3n5IIXwgiFRta4mnz0XK0WvRb6bLPXK53AbBw/edit?usp=sharing).",
patch_notes: '\n**0.5.0**:\n - Upgraded auto-moderation system, introducing "points" given per log.\n - Introducing Legacy Log (BETA) support for importing.\n - Added an unban command.\n - Added a hotswap feature for debugging purposes.\n - General improvements preparing for future updates.\n- Added `deleteLog` command (also `remove`,`rm`,`delete`) for HR department members.\n- Various bug fixes and performance improvements.\n**0.4.1**:\n- Audit logs are now available for every command ran. This will be expanded on in the future.\n- Many bug fixes for quality of life improvements.',
help_message: "tbd",
toggles: JSON.stringify({
startupMessage:true,
tzConvert: true,
staffCmds: false,
helpCmd: true,
rulesCmd: true,
versionCmd: true,
mAddEvidence: true,
mComment: true,
mViewThread: true,
mViewUserAttachments: true,
mViewGameLogs: true,
mViewLogAttachments: true,
mViewUserStatus: true,
mCreateLogs: true,
mDeleteLogs: true,
notify: false,
nChannel: "",
mDeleteLogs: true,
autoAct: false
})
}

db.run(`INSERT INTO settings VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, [s.experiments, s.owner, s.prefix, s.token, s.log_channel, s.startup_channel, s.rules_channel, s.default_tz, s.timezone, s.WEBKEY, s.POSTKEY, s.auto_moderate, s.lowKick1Points, s.lowBan1Points, s.lowKick2Points, s.lowBan2Points, s.lowKick3Points, s.lowPermPoints, s.version, s.rules, s.patch_notes, s.help_message, s.toggles])

reasons.forEach(item => {
db.run(`INSERT INTO reasons VALUES(?,?)`, [item.reason, item.value])
})

staff.forEach(item => {
db.run(`INSERT INTO staff VALUES(?,?,?,?,?,?,?,?,?)`, [item.igid, item.name, item.ign, item.chat_id, item.username, item.role, item.warn_credit, item.kick_credit, item.ban_credit ])
})

db.close()

console.log('Database Filled!')
console.log('DatabaseV2 Filled!')
Loading