{"size": 1139, "ext": "js", "max_stars_repo_path": "commands/playDie.js", "max_stars_repo_name": "cheesenibbles123/OliverbotPublic", "max_stars_repo_stars_event_min_datetime": "2020-10-28T04:08:07.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-28T03:47:02.000Z", "max_issues_repo_path": "commands/playDie.js", "max_issues_repo_name": "cheesenibbles123/OliverbotPublic", "max_issues_repo_issues_event_min_datetime": "2021-01-11T02:18:33.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-08T03:56:36.000Z", "max_forks_repo_path": "commands/playDie.js", "max_forks_repo_name": "cheesenibbles123/OliverbotPublic", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 24.7608695652, "max_line_length": 71, "alphanum_fraction": 0.5838454785}
const glob = require("./_globalFunctions");

let bot;

module.exports = {
	name: "playdie",
	help: "Rolls a normal die against the bot",
	interactionSupport: true,
	init: (botInstance) => {
		bot = botInstance;
	},
	execute: (message,args) => {
		let user = glob.getRandomInt(7);
		let botroll = glob.getRandomInt(7);
		message.channel.send("🎲").then((msg)=>{
			msg.edit("..🎲").then((msg)=>{
				msg.edit("You: "+user+", Bot: "+botroll+" ....🎲");
				if (user>botroll){
					message.channel.send("You Win!");
				}else
				if (user<botroll){
					message.channel.send("You Lose!");
				}else{
					message.channel.send("Draw!");
				}
			});
		});
	},
	executeInteraction: (interaction,args) => {
		let user = glob.getRandomInt(7);
		let botroll = glob.getRandomInt(7);
		bot.channels.cache.get(interaction.channedId).send("🎲").then((msg)=>{
			msg.edit("..🎲").then((msg)=>{
				msg.edit("You: "+user+", Bot: "+botroll+" ....🎲");
				if (user>botroll){
					interaction.editReply("You Win!");
				}else
				if (user<botroll){
					interaction.editReply("You Lose!");
				}else{
					interaction.editReply("Draw!");
				}
			});
		});
	}
}