import { handleCheer } from "events/message";
import { Command, sendMessage } from "lib/commandUtils";
import parseCommandArgs from "lib/parseCommandArgs";

export default new Command({
	name: "testcheer",
	aliases: ["testcheer"],
	usertype: "streamer",
	disableable: false,
	execution: async (msg, user) => {
		const args = parseCommandArgs(msg.messageText);
		if (!args[0]) {
			await sendMessage(
				"Please specify the amount of fake bits you want to send",
				msg.messageId,
			);
			return;
		}
		if (Number.isNaN(parseInt(args[0], 10))) {
			await sendMessage(`${args[0]} is not a valid amout of bits`);
			return;
		}
		const bits = Number(args.shift()); // we shift it so the amount of bits isn't part of the handleCheer message, we already know that args[0] can be parsed as a number so this is fine.
		await handleCheer(msg, bits, user);
	},
});
