user registration, bal, change_bal, transfer
This commit is contained in:
26
commands/register_user.ts
Normal file
26
commands/register_user.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { ChatInputCommandInteraction } from "discord.js";
|
||||
|
||||
import type { CommandData } from "./index";
|
||||
import { get_user, add_new_user } from "../db";
|
||||
import { BotError } from "./error";
|
||||
|
||||
async function run(interaction: ChatInputCommandInteraction) {
|
||||
await interaction.deferReply();
|
||||
const options = interaction.options;
|
||||
const target_id = (await options.get("target")).user.id;
|
||||
if (await get_user(target_id)) throw new BotError("Target is already registered");
|
||||
await add_new_user(target_id);
|
||||
return await interaction.editReply({ content: `Registered <@${target_id}>`, allowedMentions: { users: [] } });
|
||||
}
|
||||
|
||||
const data: CommandData = {
|
||||
name: "register_user",
|
||||
description: "Register a user so they can participate in the bot economy",
|
||||
registered_only: false,
|
||||
ephemeral: false,
|
||||
admin_only: true,
|
||||
run,
|
||||
};
|
||||
|
||||
export default data;
|
||||
|
||||
Reference in New Issue
Block a user