add joins command
This commit is contained in:
parent
2841183fd3
commit
07b5dc1f17
2 changed files with 25 additions and 0 deletions
23
src/commands/joins.js
Normal file
23
src/commands/joins.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Command } from "./commands.js"
|
||||
|
||||
export default class JoinsCommand extends Command {
|
||||
|
||||
#chat
|
||||
#stmt
|
||||
|
||||
constructor(chat, db) {
|
||||
super("joins")
|
||||
this.#chat = chat
|
||||
|
||||
this.#stmt = db.prepare(`
|
||||
SELECT COUNT(p.id) AS "count"
|
||||
FROM player p;
|
||||
`)
|
||||
}
|
||||
|
||||
run(username, args) {
|
||||
const data = this.#stmt.get()
|
||||
const joins = data["count"]
|
||||
this.#chat.chat(`I saw ${joins} unique players join`)
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ import PlaytimeCommand from "./commands/playtime.js"
|
|||
import SeenCommand from "./commands/seen.js"
|
||||
import TPSCommand from "./commands/tps.js"
|
||||
import WorstPingCommand from "./commands/worst-ping.js"
|
||||
import JoinsCommand from "./commands/joins.js"
|
||||
|
||||
|
||||
console.log(`____ _ ____ _ ____ _ `)
|
||||
|
@ -133,6 +134,7 @@ function newClient() {
|
|||
commands.register(new HelpCommand(chat, commands))
|
||||
commands.register(new InfoCommand(chat))
|
||||
commands.register(new JoinDateCommand(chat, db, dateFormat))
|
||||
commands.register(new JoinsCommand(chat, db))
|
||||
commands.register(new PingCommand(chat, players))
|
||||
commands.register(new PlaytimeCommand(chat, db))
|
||||
commands.register(new SeenCommand(chat, db, dateFormat))
|
||||
|
|
Loading…
Add table
Reference in a new issue