diff options
author | WlodekM <[email protected]> | 2024-11-30 14:24:39 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-11-30 14:24:39 +0200 |
commit | 714a4189eb02051ddd330513048b07b3be070e27 (patch) | |
tree | 64112d5ce9d2b433cc4be0adf561ac128a3d84b5 /commands | |
parent | f37e3537adb59f2b724259a1720295756eb94277 (diff) |
do stuff 3
Diffstat (limited to 'commands')
-rw-r--r-- | commands/ban.ts (renamed from commands/ban.js) | 7 | ||||
-rw-r--r-- | commands/kick.ts (renamed from commands/kick.js) | 6 | ||||
-rw-r--r-- | commands/motd.ts (renamed from commands/motd.js) | 6 |
3 files changed, 12 insertions, 7 deletions
diff --git a/commands/ban.js b/commands/ban.ts index 584b4d0..77d23b5 100644 --- a/commands/ban.js +++ b/commands/ban.ts @@ -1,14 +1,15 @@ import fs from "node:fs"; +import { CommandFnArgs } from "../commands.ts" export default { name: "ban", aliases: [], - command: function ({ user, server, args }) { + command: function ({ user, server, args }: CommandFnArgs) { if(!user.admin) return user.socket.send("You are not admin"); if(!server.accounts.checkAccount(args[0])) return user.socket.send("Account not found"); - let theUser = Object.values(server.users).find(a => a.username == args[0]); + const theUser = Object.values(server.users).find(a => a.username == args[0]); theUser.socket.send('you were kicked because you were banned, L'); - let ipBanList = JSON.parse(String(fs.readFileSync("db/bannedIps.json"))); + const ipBanList = JSON.parse(String(fs.readFileSync("db/bannedIps.json"))); ipBanList[theUser.ip] = args[1] ?? 'reason'; ipBanList['account:'+args[0]] = args[1] ?? 'reason'; theUser.socket.close(1003, "Kicked"); diff --git a/commands/kick.js b/commands/kick.ts index accadb0..60568ed 100644 --- a/commands/kick.js +++ b/commands/kick.ts @@ -1,10 +1,12 @@ +import { CommandFnArgs } from "../commands.ts" + export default { name: "kick", aliases: [], - command: function ({ user, server, args }) { + command: function ({ user, server, args }: CommandFnArgs) { if(!user.admin) return user.socket.send("You are not admin"); if(!server.accounts.checkAccount(args[0])) return user.socket.send("Account not found"); - let theUser = Object.values(server.users).find(a => a.username == args[0]); + const theUser = Object.values(server.users).find(a => a.username == args[0]); theUser.socket.send('you were kicked') theUser.socket.close(1003, "Kicked"); }, diff --git a/commands/motd.js b/commands/motd.ts index a4e7fde..43293c9 100644 --- a/commands/motd.js +++ b/commands/motd.ts @@ -1,7 +1,9 @@ +import { CommandFnArgs } from "../commands.ts" + export default { name: "motd", aliases: [], - command: function ({ user, server }) { - user.socket.send("MOTD: " + server.format(server.config.motd)); + command: function ({ user, server }: CommandFnArgs) { + user.socket.send("MOTD: " + server.format(server.config.server.motd)); }, }; |