Split up moon counter from the database #489
2 changed files with 0 additions and 48 deletions
|
@ -1,45 +0,0 @@
|
|||
import { CommandInteraction, EmbedBuilder, PermissionFlagsBits, SlashCommandBuilder } from "discord.js";
|
||||
import { Command } from "../../type/command";
|
||||
import UserSetting from "../../database/entities/UserSetting";
|
||||
import EmbedColours from "../../constants/EmbedColours";
|
||||
|
||||
export default class MoonSet extends Command {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.CommandBuilder = new SlashCommandBuilder()
|
||||
.setName("moonset")
|
||||
.setDescription("Manually set a user's moons")
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||
.addUserOption(x => x
|
||||
.setName("user")
|
||||
.setDescription("The user to set")
|
||||
.setRequired(true))
|
||||
.addNumberOption(x => x
|
||||
.setName("count")
|
||||
.setDescription("The amount the user will have")
|
||||
.setRequired(true)
|
||||
.setMinValue(0));
|
||||
}
|
||||
|
||||
public override async execute(interaction: CommandInteraction) {
|
||||
const user = interaction.options.get("user", true).user!;
|
||||
const count = interaction.options.get("count", true).value! as number;
|
||||
|
||||
let moonSetting = await UserSetting.FetchOneByKey(user.id, "moons");
|
||||
|
||||
if (moonSetting) {
|
||||
moonSetting.UpdateValue(`${count}`);
|
||||
} else {
|
||||
moonSetting = new UserSetting(user.id, "moons", `${count}`);
|
||||
}
|
||||
|
||||
await moonSetting.Save(UserSetting, moonSetting);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(EmbedColours.Ok)
|
||||
.setDescription(`Moon count for ${user.username} set to ${count}`);
|
||||
|
||||
await interaction.reply({ embeds: [ embed ]});
|
||||
}
|
||||
}
|
|
@ -31,7 +31,6 @@ import ListLobby from "./commands/501231711271780357/Lobby/list";
|
|||
|
||||
// Command Imports: Potato Talk
|
||||
import Moons from "./commands/304276391837302787/moons";
|
||||
import MoonSet from "./commands/304276391837302787/moonset";
|
||||
|
||||
// Event Imports
|
||||
import GuildMemberAdd from "./events/MemberEvents/GuildMemberAdd";
|
||||
|
@ -77,7 +76,6 @@ export default class Registry {
|
|||
|
||||
// Exclusive Commands: Potato Talk
|
||||
CoreClient.RegisterCommand("moons", new Moons(), "304276391837302787");
|
||||
CoreClient.RegisterCommand("moonset", new MoonSet(), "304276391837302787");
|
||||
|
||||
// Add Exclusive Commands to Test Server
|
||||
CoreClient.RegisterCommand("lobby", new Lobby(), "442730357897429002");
|
||||
|
@ -86,7 +84,6 @@ export default class Registry {
|
|||
CoreClient.RegisterCommand("listlobby", new ListLobby(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("entry", new Entry(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("moons", new Moons(), "442730357897429002");
|
||||
CoreClient.RegisterCommand("moonset", new MoonSet(), "442730357897429002");
|
||||
}
|
||||
|
||||
public static RegisterEvents() {
|
||||
|
|
Loading…
Reference in a new issue