diff --git a/index.ts b/index.ts index c4c7c4c..95b00c6 100644 --- a/index.ts +++ b/index.ts @@ -58,7 +58,7 @@ SPOTIFY_SECRETID: Spotify client ID for the &chart command to show artist images genius_api: GENIUS_API, url: GLOBALS.LASTFM_ENDPOINT, - }).init_dev(); + }).init(); const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildPresences], diff --git a/src/handlers/CrownBot.ts b/src/handlers/CrownBot.ts index bcdf75c..e7427b2 100644 --- a/src/handlers/CrownBot.ts +++ b/src/handlers/CrownBot.ts @@ -51,7 +51,7 @@ export default class CrownBot { * - Finally, logs the bot in. */ - async init_dev() { + async init() { await this.load_db(); this.load_models(); await this.register_commands(); diff --git a/src/handlers/DB.ts b/src/handlers/DB.ts index 7fd3ca6..a09415d 100644 --- a/src/handlers/DB.ts +++ b/src/handlers/DB.ts @@ -6,7 +6,6 @@ import { UserTopArtist } from "../interfaces/ArtistInterface"; import { DBUser } from "../interfaces/DBUserInterface"; import { LeaderboardInterface } from "../interfaces/LeaderboardInterface"; import { ServerConfigInterface } from "../models/ServerConfig"; -import { SnapLogInterface } from "../models/SnapLog"; export default class DB { #models: { [key: string]: Model }; @@ -342,64 +341,4 @@ export default class DB { } return server_config; } - - /// TEMPORARY HELPER FUNCTIONS FOR &eval command snap AND WHATEVER IT AFFECTS - // (https://discord.com/channels/657915913567469588/663355060058718228/879388787489276034) - - async find_multiple_usernames(): Promise { - return await this.#models.crowns.aggregate([ - { - $group: { - _id: { userID: "$userID", guildID: "$guildID" }, - usernames: { $addToSet: "$lastfm_username" }, - }, - }, - { - $project: { - _id: 0, - userID: "$_id.userID", - guildID: "$_id.guildID", - username_count: { - $size: "$usernames", - }, - }, - }, - { - $match: { - username_count: { - $gt: 1, - }, - }, - }, - ]); - } - - async check_snap(guildID: string, userID: string) { - const snap_log = await this.#models.snaplog.findOne({ userID, guildID }); - return !!snap_log; - } - - async snap(guildID: string, userID: string) { - return await this.#models.snaplog.findOneAndUpdate( - { - userID, - guildID, - }, - { - userID, - guildID, - }, - { - upsert: true, - useFindAndModify: false, - } - ); - } - - async unsnap(guildID: string, userID: string) { - return await this.#models.snaplog.deleteMany({ - userID, - guildID, - }); - } } diff --git a/src/models/SnapLog.ts b/src/models/SnapLog.ts deleted file mode 100644 index f02b3f1..0000000 --- a/src/models/SnapLog.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Mongoose } from "mongoose"; - -export interface SnapLogInterface { - userID: string; - guildID: string; -} -export default (mongoose: Mongoose) => { - return new mongoose.Schema({ - userID: String, - guildID: String, - }); -};