From 9333849c797914a218caca29b0f740e96d39cd1d Mon Sep 17 00:00:00 2001 From: Tolfx Date: Tue, 17 Jan 2023 15:43:36 +0100 Subject: [PATCH] feat: created clear cart command (#1475) --- .../Commands/commands/cart/ClearCart.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/classes/Commands/commands/cart/ClearCart.ts diff --git a/src/classes/Commands/commands/cart/ClearCart.ts b/src/classes/Commands/commands/cart/ClearCart.ts new file mode 100644 index 000000000..ace141919 --- /dev/null +++ b/src/classes/Commands/commands/cart/ClearCart.ts @@ -0,0 +1,29 @@ +import SteamID from 'steamid'; +import CommandHandler, { ICommand } from '../../CommandHandler'; +import Bot from '../../../Bot'; +import IPricer from '../../../IPricer'; +import Cart from '../../../Carts/Cart'; + +export default class ClearCartCommand implements ICommand { + name = 'clearcart'; + + description = 'View your cart 🛒'; + + allowInvalidType = false; + + constructor( + public readonly bot: Bot, + public readonly pricer: IPricer, + public readonly commandHandler: CommandHandler + ) { + this.bot = bot; + this.pricer = pricer; + this.commandHandler = commandHandler; + } + + execute = (steamID: SteamID, message: string) => { + Cart.removeCart(steamID); + const custom = this.bot.options.commands.clearcart.customReply.reply; + this.bot.sendMessage(steamID, custom ? custom : '🛒 Your cart has been cleared.'); + }; +}