-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: created clear cart command (#1475)
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.'); | ||
}; | ||
} |