Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
242 commits
Select commit Hold shift + click to select a range
f3d151a
base Sequelize code
dewsmith0 May 22, 2022
cf7aac4
database stuff
dewsmith0 May 22, 2022
4d90ff3
test warn command
dewsmith0 May 22, 2022
44161c4
oops
dewsmith0 May 22, 2022
6fa9a12
oops 2 electric boogaloo
dewsmith0 May 22, 2022
3dcbdfc
ban database + small fix
dewsmith0 May 22, 2022
8a43211
fixed cache errors
dewsmith0 May 23, 2022
ffb4bd0
fixed ban command
dewsmith0 May 23, 2022
c93c1f6
attempting to convert messages to embeds
dewsmith0 May 24, 2022
dcfc92e
oopsie
dewsmith0 May 24, 2022
9c1567f
super basic list warns command
dewsmith0 May 24, 2022
93ccca6
fix
dewsmith0 May 24, 2022
2254c00
fixing the fix
dewsmith0 May 24, 2022
7bcd044
fixing the fix's fix?
dewsmith0 May 24, 2022
3d9b48e
debug commit
dewsmith0 May 24, 2022
9620584
Now a dev branch! with some change
5jiji May 24, 2022
1d91c5c
Merge pull request #2 from 5jiji/sequelize-tests to dev
5jiji May 24, 2022
063daef
Merge branch 'dev' into embed
5jiji May 24, 2022
11f9f29
Merge pull request #4 from 5jiji/embed to dev
5jiji May 24, 2022
7e13f99
Merge pull request #3 from 5jiji/list-command to dev
5jiji May 24, 2022
7430b80
Make the ban.jsa little more... readable
5jiji May 25, 2022
7b13b19
Same as ban.js => more readable
5jiji May 25, 2022
8f461b1
starting to merge the databases
dewsmith0 May 27, 2022
a4ec7b8
i forgor await :skull:
dewsmith0 May 27, 2022
b5c82e9
Try something...
5jiji May 27, 2022
bf3e296
doesn't work
5jiji May 27, 2022
f1bead0
fix ban command
dewsmith0 May 28, 2022
b3a3daa
rewrite ban command
dewsmith0 May 28, 2022
784367a
fix ban command 2
dewsmith0 May 28, 2022
9d56ed0
fix ban command 3
dewsmith0 May 28, 2022
23f39aa
debug log
dewsmith0 May 28, 2022
cfec0d5
maybe this will work
dewsmith0 May 28, 2022
eac597d
testing list warn (proof of concept)
dewsmith0 May 28, 2022
405c9a8
Joke ban, kick, and warn added (not tested yet)
5jiji May 28, 2022
392dabd
fix
5jiji May 29, 2022
4622571
Added all subcommand to the list command
5jiji May 29, 2022
0f27da2
Save guard to not kick, ban, or warn the bot with itself
5jiji May 29, 2022
9c95b67
Forgot the require of clientId...
5jiji May 29, 2022
d351a06
I always forgot something as i see....
5jiji May 29, 2022
bc53f2c
Forgot the timeout command
5jiji May 29, 2022
d79c615
forgot the clientId, again
5jiji May 29, 2022
9dde9a6
there you go
5jiji May 29, 2022
0a8d939
It should work normally now...
5jiji May 30, 2022
442a366
fix list command?
dewsmith0 May 30, 2022
1f3e266
fix slowmode command
dewsmith0 May 31, 2022
f8e3e11
I think this is better
5jiji May 31, 2022
0c049df
Merge branch 'dev' of https://github.com/Progressbar-Discord-Server/P…
5jiji May 31, 2022
d248eb9
Get command created
5jiji Jun 6, 2022
fd0fc36
error while pushing slash command fix
5jiji Jun 6, 2022
2d17fba
Why
5jiji Jun 6, 2022
d0002df
At one point it will work right?
5jiji Jun 6, 2022
d018998
Another try... How many try will i need? idk
5jiji Jun 6, 2022
b127464
I really don't know
5jiji Jun 6, 2022
94c23c9
Again
5jiji Jun 6, 2022
fdd023e
And Again...
5jiji Jun 6, 2022
fdc79b2
And And Again...
5jiji Jun 6, 2022
fb9edd1
And And And Again...
5jiji Jun 6, 2022
211710d
Console.log Moment
5jiji Jun 6, 2022
9b0bd76
console.log Moment * 2
5jiji Jun 6, 2022
09bd272
Better, right?
5jiji Jun 6, 2022
851c169
Maybe this is better?
5jiji Jun 6, 2022
4c13f8d
I'm not that good with for loop, there might be error
5jiji Jun 6, 2022
fb0d4fb
Why not?
5jiji Jun 6, 2022
f7263c6
when you forget things
5jiji Jun 6, 2022
dc54432
~~console.log Member *3~~
5jiji Jun 6, 2022
f308db4
Color role command!
5jiji Jun 6, 2022
5b81417
This should be better
5jiji Jun 6, 2022
af89f09
Meh
5jiji Jun 6, 2022
fc0e67f
Butter
5jiji Jun 6, 2022
cbc39d4
Maybe?
5jiji Jun 6, 2022
494378b
Maybe Maybe?
5jiji Jun 6, 2022
c98264b
When fs doesn't like arrays
5jiji Jun 6, 2022
2546dc8
I FORGOT THE FRICKING BRACKET
5jiji Jun 6, 2022
0e53e69
vscode wanted to crash and it did
5jiji Jun 6, 2022
0319972
trying a fix
5jiji Jun 6, 2022
8c7665d
Meh
5jiji Jun 6, 2022
52e3cfb
Found the bug... i think
5jiji Jun 6, 2022
4afa897
Go back in time... console.log Mement *3
5jiji Jun 6, 2022
9ce550f
Trying something
5jiji Jun 6, 2022
328dc2b
console.log * 4
5jiji Jun 6, 2022
d50aa65
Some quality of life feature
5jiji Jun 7, 2022
0918e1e
Welp
5jiji Jun 7, 2022
02e4978
Welp * 2
5jiji Jun 7, 2022
b07d978
Welp * 3
5jiji Jun 7, 2022
98637fa
Welp * 4
5jiji Jun 7, 2022
c9bf1e0
Welp * 5, no space allowed...
5jiji Jun 7, 2022
81941da
Get moving the bracket
5jiji Jun 7, 2022
206d8a3
Forgor...
5jiji Jun 7, 2022
b356904
Heh, why not
5jiji Jun 7, 2022
3029258
If this works, thank you stuartt :angry:
5jiji Jun 7, 2022
47489cf
It seems better.... this is not normal
5jiji Jun 7, 2022
475f0c5
Heh, forgot one...
5jiji Jun 7, 2022
1ceeec9
HEX COLOR
5jiji Jun 7, 2022
20f180a
NO MORE console.log
5jiji Jun 7, 2022
5b57b16
Tring to see if discord can bug...
5jiji Jun 7, 2022
c09c8d5
A try blouk
5jiji Jun 7, 2022
1e82f50
Eh
5jiji Jun 7, 2022
9204cef
server.channel.create *should* work
5jiji Jun 7, 2022
97891cf
sometimes, **s** are important...
5jiji Jun 7, 2022
1faab32
How did i forgot this???
5jiji Jun 7, 2022
92b2da2
Cooler command like that
5jiji Jun 8, 2022
fca3760
I think that would work better
5jiji Jun 8, 2022
3715f7e
Nope, it would work better like this
5jiji Jun 8, 2022
5faab82
Now Ephemeral:tm:
5jiji Jun 8, 2022
3f0cd59
without any variable that is not necessary
5jiji Jun 8, 2022
da0be2e
Better?
5jiji Jun 8, 2022
361b029
Whoops
5jiji Jun 8, 2022
ae7c7d2
Better explanation
5jiji Jun 8, 2022
85a4928
Better, way better to not calculate
5jiji Jun 8, 2022
90f7d8c
Not useful but still
5jiji Jun 8, 2022
f593b5a
*Sigh* i forgot to make the change everywhere
5jiji Jun 8, 2022
7a98193
*Sigh* Again...
5jiji Jun 8, 2022
cec8f0c
I will never get them all at the same time uh
5jiji Jun 8, 2022
c3b48a0
Uh
5jiji Jun 8, 2022
dbee807
ummmmmmmmm
5jiji Jun 8, 2022
5a618e2
There you go
5jiji Jun 8, 2022
99e7ae3
*Should* work
5jiji Jun 8, 2022
04c5122
Should be even better (if it was working, not like the last one
5jiji Jun 8, 2022
47ef5c0
Trying to get luihum to fix this...
5jiji Jun 12, 2022
10d74a4
Big commit
5jiji Jun 26, 2022
b4d15aa
New Command!
5jiji Jun 26, 2022
85ba733
Subcommand of get added!
5jiji Jun 26, 2022
01a074f
Better like that...
5jiji Jun 26, 2022
4734e4c
Forgot the fallback :skull:
5jiji Jun 26, 2022
c0390ef
Better slowmode command
5jiji Jun 29, 2022
03dc319
Useless, but still cool to have
5jiji Jul 2, 2022
9940dc2
A lot of ; nothing else
5jiji Jul 2, 2022
84ce9e6
some fixes + /get stickers added
5jiji Jul 2, 2022
a67df75
Changed the way to get files, and some other things
5jiji Jul 4, 2022
dd4cef2
Bad referance...
5jiji Jul 5, 2022
8511a9e
New option for most subcommand
5jiji Jul 5, 2022
a739861
If you update main.js for having folder in commands, you should chang…
5jiji Jul 5, 2022
875f802
New readme file
5jiji Jul 6, 2022
9660b82
Good thing incoming
5jiji Jul 6, 2022
8f647d3
FORGOT TO DELETE THAT FRICKING CONSOLE.LOG
5jiji Jul 6, 2022
c30e690
Go on, i do some big work today uh
5jiji Jul 6, 2022
2da796b
Merge branch 'Starboard' into dev
5jiji Jul 6, 2022
eeee899
Get compresed, main
5jiji Jul 6, 2022
4a101c0
First iteration of the starboard!
5jiji Jul 6, 2022
95d74d3
Some changes
5jiji Jul 6, 2022
9f722e1
Eh, doesn't want to work still...
5jiji Jul 6, 2022
67244a0
Still doesn't work, but it's still *should* be better with this extra…
5jiji Jul 7, 2022
54bcd0a
New command: Role
5jiji Jul 21, 2022
2d07e11
Don't forget that for the bot on the server
5jiji Jul 21, 2022
b56d2c3
New feature: DOS IN CONSOLE!
5jiji Jul 21, 2022
ff6a6fe
Updated command with discord js v14.0.3
5jiji Jul 22, 2022
41ccf2b
New DOS command: tail: Shows messages in the channel given
5jiji Jul 24, 2022
3eb8b9f
Tail: Now with message ids:tm:
5jiji Jul 24, 2022
0b653b1
Forgot those with discordjs v14 :skull:
5jiji Jul 24, 2022
ca19ac9
Actually, they have all changed, i may have never saved them...
5jiji Jul 24, 2022
b064752
Command 'get' now work
5jiji Aug 4, 2022
7506c81
Some Fixes
5jiji Aug 4, 2022
159bc9b
Maybe a better fix?
5jiji Aug 4, 2022
9f318cb
The get command now uses the pastebin API
5jiji Aug 5, 2022
add45ad
Some Little change
5jiji Aug 6, 2022
5fad7b3
Update of the ban command
5jiji Aug 8, 2022
0ebf856
When you forgot to import someything: :skull:
5jiji Aug 11, 2022
8b3e740
Fix of unban.js
5jiji Aug 11, 2022
5b70d2f
Added eval.js, i should NOT allow anyone to execute this command...
5jiji Aug 11, 2022
6384e42
Fix of ban.js
5jiji Aug 11, 2022
766795e
I was like Robtop: I added feature, but never pushed...
5jiji Aug 20, 2022
d15dd76
Whoops
5jiji Aug 20, 2022
965ce2d
New DOS command: deploy: deploying / command
5jiji Aug 20, 2022
f82fd33
Timeout command using a switch, dammit
5jiji Aug 21, 2022
53b2ed1
Fix of replyEmbed and change in timeout command
5jiji Aug 25, 2022
8bc1b46
escapeMarkdown moment
5jiji Sep 4, 2022
f4359d7
Great update, isn't it?
5jiji Sep 4, 2022
f562375
Joke ban & kick is better
5jiji Sep 8, 2022
42a1f45
This is better like that, isn't it?
5jiji Sep 10, 2022
b1c6583
STARBOARD!!!!!
5jiji Sep 11, 2022
126a309
Oops... that's a big error
5jiji Sep 11, 2022
2177427
wrong one, the bot will crash at every posted message.... bruh
5jiji Sep 11, 2022
8524c98
How did i forget that???
5jiji Sep 11, 2022
6e92c1d
If you really want it
5jiji Sep 11, 2022
d678530
Starboard button!
5jiji Sep 11, 2022
e399e78
Random Color for the starEmbed
5jiji Sep 11, 2022
4083269
This was stupid...
5jiji Sep 14, 2022
7275a32
better to use json with http request then url-encoded
5jiji Sep 16, 2022
f4a2464
Multi Emoji Starboard with threads
5jiji Sep 16, 2022
912520d
Oops
5jiji Sep 16, 2022
bea292d
I forgot half of the update :skull:
5jiji Sep 16, 2022
f6d197c
Some more check for the starboard
5jiji Sep 17, 2022
b4f9671
Added the delwarn command
5jiji Sep 17, 2022
ca14f72
template outdated
5jiji Sep 17, 2022
bbe6f8c
I would love that this isn't the fix
5jiji Sep 18, 2022
fb98526
Don't say it
5jiji Sep 18, 2022
8e373ed
/Info command added
5jiji Sep 18, 2022
d86776e
Starboard With Reply Messages!
5jiji Sep 21, 2022
fc640b2
FIX FIX FIX FIX FIX
5jiji Sep 21, 2022
13dbff5
God dammit await
5jiji Sep 21, 2022
e843217
Don't take message from other servers!
5jiji Sep 23, 2022
e504e99
Better.
5jiji Sep 23, 2022
b856e7d
Now pushing global commands instead of guild commands
5jiji Sep 24, 2022
ce5dac8
if rest.put gives a promise, a try block isn't needed
5jiji Sep 24, 2022
b90763b
if (big error) send discord message
5jiji Sep 25, 2022
7a4fd36
setDefaultMemberPermissions moment
5jiji Sep 25, 2022
ffc7556
rename things because deprecated or other
5jiji Sep 25, 2022
3b3b7ce
no more sub-sub-folder in the context menu folder
5jiji Sep 25, 2022
bd2c2c0
Reddit-chat can now be a thread, like Pankine wanted
5jiji Sep 25, 2022
1cd545e
This is a stupid error isn't it?
5jiji Sep 25, 2022
0133d50
Fix embed in errors handler
5jiji Sep 25, 2022
3bb2c11
Create thread on the message itself
5jiji Sep 26, 2022
743e4ca
Partial has come back, but message will have a 20 days old limit
5jiji Sep 28, 2022
bb4fd36
Fix spam log?
5jiji Sep 29, 2022
bf20c31
Stupid Typo
5jiji Sep 30, 2022
1216597
Forgot half of the fix
5jiji Sep 30, 2022
5df244c
Update config.json.template
RealMCoded Oct 2, 2022
3b704d6
Forgot the reddit config
5jiji Oct 2, 2022
d3a7506
Starboard Fixed maybe?
5jiji Oct 2, 2022
58e6572
Edit bot's message from a context menu & some changed
5jiji Oct 9, 2022
8b905c2
Fix of the context menu for editing bot messages
5jiji Oct 12, 2022
5afd951
Fricking await
5jiji Oct 12, 2022
70ab6d5
You actually need to fetch the message THEN the channel god dammit
5jiji Oct 12, 2022
d01d33e
DO NOT say it was that if was the problem
5jiji Oct 12, 2022
d6d5ac3
Would it work now? i hope so...
5jiji Oct 14, 2022
25a0a88
Forgot catchs god dammit
5jiji Oct 14, 2022
0529098
Should fix errors when starting up
5jiji Oct 26, 2022
7063c81
Timeout fix
5jiji Nov 12, 2022
d620761
No more buch error in startup
5jiji Nov 15, 2022
a8d4e82
Finaly found the fucking timeout problem
5jiji Nov 19, 2022
8aa0cda
Fuck it, finaly found it
5jiji Nov 19, 2022
ab06003
Boi Finaly
5jiji Nov 19, 2022
46391fd
Forgot that debugging thing
5jiji Nov 19, 2022
018a567
i always forgot await with deferReply
5jiji Nov 19, 2022
ff8cb02
break in switch
5jiji Nov 19, 2022
6269b4e
It's a fucking array
5jiji Nov 19, 2022
0fc304f
added the joke part + the correct logic
5jiji Nov 19, 2022
32c95c9
color red if failed
5jiji Nov 19, 2022
c666f43
Final commit for timeout.
5jiji Nov 19, 2022
cc52873
No reason Provided
5jiji Nov 19, 2022
f3e08d3
No reason provided 2
5jiji Nov 19, 2022
344f138
joke first
5jiji Nov 19, 2022
2418940
No reason provided 3 (Is it becomming like the stanley parable ultra …
5jiji Nov 19, 2022
8252c94
Some more logical edit of the log
5jiji Nov 19, 2022
74bfef5
28 days fix
5jiji Nov 19, 2022
78916e4
better role-selector system
5jiji Nov 20, 2022
3c09471
28 days fix
5jiji Nov 20, 2022
26d4c26
role-selector fix
5jiji Nov 20, 2022
572bc76
What were you doing in here?
5jiji Nov 20, 2022
bf852de
ping.js
5jiji Nov 29, 2022
9985923
forgot ephemeral
5jiji Nov 29, 2022
3e505f6
better README (not that much tho...)
5jiji Nov 30, 2022
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
config.json
node_modules/
jsconfig.json
jsconfig.json
database.sqlite
44 changes: 44 additions & 0 deletions .vscode/javascript.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"Discord Slash Commands": {
"body": [
"const { SlashCommandBuilder } = require('discord.js')",
"",
"module.exports = {",
" data: new SlashCommandBuilder()",
" .setName('$0')",
" .setDescription(\"\"),",
" async execute(interaction) {",
" ",
" }",
"}"
]
},
"Discord User Context Menu": {
"body": [
"const { ContextMenuCommandBuilder } = require('discord.js');",
"",
"module.exports = {",
" data: new ContextMenuCommandBuilder()",
" .setName('$0')",
" .setType(2),",
" async execute(interaction) {",
" ",
" }",
"}"
]
},
"Discord Message Context Menu": {
"body": [
"const { ContextMenuCommandBuilder } = require('discord.js');",
"",
"module.exports = {",
" data: new ContextMenuCommandBuilder()",
" .setName('$0')",
" .setType(3),",
" async execute(interaction) {",
" ",
" }",
"}"
]
}
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"autoSnippet.snippets": [
{
"pattern": "**/context menu/User/*.js",
"snippet": "Discord User Context Menu"
},
{
"pattern": "**/context menu/Messages/*.js",
"snippet": "Discord Message Context Menu"
},
{
"pattern": "**/commands/*.js",
"snippet": "Discord Slash Commands"
}
]
}
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Progressbar Ruler Discord Bot
# Processes Discord Bot

This is a moderation bot for the Progressbar95 Fan Discord Server.
This is a moderation bot for the [Progressbar95 Fan Server](https://discord.gg/HWFYmwsFX9).

## Setting up

This bot is made with the Node.js runtime.

1. Install Node.js 17 and Git.
2. Run `git clone https://github.com/5jiji/Progressbar-Ruler`.
1. Install Node.js 17.
2. Download the latest release [here](https://github.com/Progressbar-Discord-Server/Processes/releases)
3. Copy `config.json.template` to `config.json` and fill in the variables.
4. Run `npm i` to install the required modules.
5. Invite the bot with this link: `https://discord.com/oauth2/authorize?client_id=[ClientID]&permissions=8&scope=bot%20applications.commands` (replace `[ClientID]` with the bot's ID)
6. Register the slash commands with `node deploy-commands.js`.
7. Start the bot with `node .`. The database will automatically be created for you.
5. Register the slash commands with `node deploy-commands.js`.
6. Start the bot with `node .`. The database will automatically be created for you.
7. Invite the bot with the link the console send (Only if "showLink" variable in config.json is true)
249 changes: 249 additions & 0 deletions Util/Dos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
const fs = require('node:fs');
const readline = require('readline');

async function ProcessDOS(client) {
const cmd = readline.createInterface(process.stdin, process.stdout);

let drive = "S"
let dir = ["\\"]
let drvlabel = "SERVERS"
let depth = 0
let curServer = null
let curC = null
let drvS = {}
let drvC = {}
let inRepl = false
let object = {}
let pm2 = false
if (process.env.PM2_USAGE) pm2 = true
console.log("The object 'object' is used for setting a variable inside for use later with the eval command")
drvS.rootdirs = client.guilds.cache
drvS.subdirs = null
drvC.rootdirs = fs.readdirSync(`${__dirname}/../commands`);
drvC.subdirs = null
//console.log(paths)
cmd.setPrompt(`${drive}:${dir.join("")}>`)
cmd.prompt();

cmd.on('line', async line => {
if (inRepl) return
switch (line.trim().split(" ")[0]) {
case 'exit': {
if (!pm2) {
cmd.close()
await client.destroy()
process.exit(0)
}
else if (pm2) console.log("You are using pm2, to exit the command line, use Ctrl+C.\nIf you want to reload command file, use reload in the C: drive")
break
}
case 'eval': {
try {
console.log(eval(line.substring(4)))
} catch (error) {
console.error(error)
}
break
}
case 'help': case 'man': {
const log = console.log
log("Process DOS help")
log("Commands:\n")
log("eval <code> Evaluates code")
log("status <status> <activity> <description> Changes the status of the bot")
log("send <channel-id> <message> Sends a message on the specified channel")
log("dir Lists the current directory")
log("tail <channel-id> [Amount-of-messages] Lists message in the channel given")
log("type <file> Show the contents of a file")
log("cd [directory] Change directory")
log("cls Clears the screen")
log("echo <text> Displays text on the screen")
log("help Displays this help")
log("exit Terminates the bot and console")
log("reload Reload Command or server, depending on the drive in which executed")
log("deploy Deploy slash (/) commands")
break
}
case 'status': {
if (line.trim() == "status") { client.user.setActivity() }
try {
let status = line.split(" ")[1]
let activity = line.split(" ")[2].toUpperCase()
let description = line.split(" ").slice(3).join(" ")
client.user.setActivity(description, { type: activity });
client.user.setStatus(status);
} catch (error) {
console.log("Invalid status")
console.error(error)
}
break
}
case 'dir': case 'ls': {
console.log(`\n Volume in drive ${drive} is ${drvlabel}`)
console.log(` Volume Serial Number is 298A-E8CC`)
console.log(` Directory of ${drive}:${dir.join("")}\n`)
switch (drive) {
case 'S': {
if (depth == 0) {
drvS.rootdirs.forEach(async i => {
if (i.name == undefined) await i.fetch()
console.log(i.name.padEnd(20) + ` (${i.id})`.padEnd(23) + "<DIR> ")
})
} else {
drvS.subdirs = client.guilds.cache.get(`${curServer}`)
drvS.subdirs.channels.cache.forEach(c => console.log(`${c.id.padEnd(19)} ${c.name.substring(0, 15).padEnd(16)} CHN`))
}
}
break
case 'C': {
if (depth == 0) {
drvC.rootdirs.forEach(i => {
console.log(i.padEnd(20) + "<DIR> ")
})
} else {
drvC.subdirs = fs.readdirSync(`${__dirname}/../commands/${curC}`);
drvC.subdirs.forEach(c => console.log(`${c.substring(0, 15).padEnd(16)} FILE`))
}
}
}
break
}
case 'cd': case 'cd..': {
let newDir = line.split(" ").slice(1).join(" ")
if (newDir === ".." || line.split(" ")[0] === "cd..") {
if (depth == 0) break
depth--
dir.pop()
curServer = null
curC = null
break
}
switch (drive) {
case 'S': {
if (drvS.rootdirs.find(i => i.name === newDir) || drvS.rootdirs.find(i => i.id === newDir)) {
depth++
if (!isNaN(+newDir)) {
let server = client.guilds.cache.find(g => g.id === newDir)
curServer = server.id
dir.push(server.name)
}
else if (isNaN(+newDir)) {
let server = client.guilds.cache.find(g => g.name === newDir)
curServer = server.id
dir.push(server.name)
}
} else {
console.log("Invalid directory")
}
break
}
case 'C': {
if (drvC.rootdirs.find(i => i === newDir)) {
dir.push(newDir)
depth++
curC = newDir
} else {
console.log("Invalid directory")
}
}
}
break
}
case 'cls': case 'clear': {
console.clear();
break
}
case 'send': {
client.channels.cache.get(line.split(" ")[1]).send(line.split(" ").slice(2).join(" "))
break
}
case 'echo': {
console.log(line.split(" ").slice(1).join(""))
break
}
case 'tail': {
if (drive === "C" || curServer == null) { console.log("Please, enter a server in the 'S' drive"); break }
let channel = line.split(" ")[1]
if (!channel) { console.log('A channel id is required'); break }
let MessageAmount = line.split(" ")[2] || 10
let Messages = await client.guilds.cache.get(curServer).channels.cache.get(channel).messages.fetch({ limit: MessageAmount })
Messages.forEach(e => {
console.log(`${e.id.padEnd(20)}${e.author.tag.padEnd(13)}${e.content}`)
})
break
}
case 'type': case 'cat': {
let file = line.split(" ").slice(1).join(" ")
if (!file) { console.log('Required parameter missing'); break }
cmd.setPrompt(" ")
switch (drive) {
case 'S': {
console.log('General failure reading drive S:')
console.log('Abort, Retry, Fail?a')
break
}
case 'C':
fs.readFile(`${__dirname}/../commands/${curC}/${file.toLowerCase()}`, 'utf8', (err, data) => {
if (err) { console.log(`File not found - ${file.toLowerCase()}`); return }
console.log(data)
})
}
console.log()
break
}
case "reload": {
switch (drive) {
case "S": {
console.log("Reloading servers, Please wait...")
await client.guilds.fetch()
drvS.rootdirs = client.guilds.cache
console.log("Reload finished")
break
}
case "C": {
const { ReloadJsFile } = require('./GetJSFile.js');
console.log("Reloading commands, Please wait...");
await ReloadJsFile(client);
console.log("Reload finished.");
break
}
};
break
}
case "deploy": {
const { send } = require("../deploy-commands.js");
const { beta } = require("../config.json");

let all = []
client.commands.forEach(e => { if (!beta && e.name !== "test" || beta) all.push(e.data.toJSON()) })
client.contextMenu.forEach(e => all.push(e.data.toJSON()))

send(all, client.token, client.user.id);
break;
}
case 'c:': case 'C:': {
drive = 'C'
drvlabel = 'COMMANDS'
depth = 0
dir = ["\\"]
break
}
case 'S:': case 's:': {
drive = 'S'
drvlabel = 'SERVERS'
depth = 0
dir = ["\\"]
break
}
case '': break
default: console.log("Bad command or file name")
};
cmd.setPrompt(`${drive}:${dir.join("")}>`)
cmd.prompt();
})
cmd.on("SIGINT", () => {
cmd.prompt()
});
};

module.exports = { ProcessDOS }
Loading