Skip to content

Commit

Permalink
feat: created clear cart command (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolfx committed Jan 17, 2023
1 parent efadad2 commit 9333849
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/classes/Commands/commands/cart/ClearCart.ts
Original file line number Diff line number Diff line change
@@ -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.');
};
}

0 comments on commit 9333849

Please sign in to comment.