TravBot-v3/src/commands/fun/eco.ts

46 lines
1.7 KiB
TypeScript
Raw Normal View History

import {Command, NamedCommand, getMemberByName, RestCommand} from "onion-lasers";
2021-03-31 03:22:25 +00:00
import {isAuthorized, getMoneyEmbed} from "./modules/eco-utils";
import {DailyCommand, PayCommand, GuildCommand, LeaderboardCommand} from "./modules/eco-core";
import {BuyCommand, ShopCommand} from "./modules/eco-shop";
2021-04-08 11:37:49 +00:00
import {MondayCommand, AwardCommand} from "./modules/eco-extras";
import {BetCommand} from "./modules/eco-bet";
export default new NamedCommand({
2020-12-15 01:44:28 +00:00
description: "Economy command for Monika.",
2021-04-10 13:34:55 +00:00
async run({send, guild, channel, author}) {
if (isAuthorized(guild, channel)) send(getMoneyEmbed(author));
},
2020-12-15 01:44:28 +00:00
subcommands: {
daily: DailyCommand,
pay: PayCommand,
guild: GuildCommand,
2020-12-15 11:15:28 +00:00
leaderboard: LeaderboardCommand,
2020-12-15 01:44:28 +00:00
buy: BuyCommand,
2020-12-16 07:24:26 +00:00
shop: ShopCommand,
2021-01-25 22:06:12 +00:00
monday: MondayCommand,
2021-04-08 11:37:49 +00:00
bet: BetCommand,
award: AwardCommand,
post: new NamedCommand({
description: "A play on `eco get`",
run: "`405 Method Not Allowed`"
})
},
id: "user",
2020-12-15 01:44:28 +00:00
user: new Command({
2020-12-15 07:56:09 +00:00
description: "See how much money someone else has by using their user ID or pinging them.",
2021-04-10 13:34:55 +00:00
async run({send, guild, channel, args}) {
if (isAuthorized(guild, channel)) send(getMoneyEmbed(args[0]));
2020-12-15 01:44:28 +00:00
}
}),
any: new RestCommand({
2020-12-15 07:56:09 +00:00
description: "See how much money someone else has by using their username.",
async run({send, guild, channel, combined}) {
if (isAuthorized(guild, channel)) {
const member = await getMemberByName(guild!, combined);
2021-04-11 08:02:56 +00:00
if (typeof member !== "string") send(getMoneyEmbed(member.user));
2021-04-10 13:34:55 +00:00
else send(member);
}
2020-12-15 01:44:28 +00:00
}
})
});