Created
March 22, 2021 19:25
-
-
Save Kile/bded5700bcba9bff0323b3752a5245b6 to your computer and use it in GitHub Desktop.
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
const commands = new discord.command.CommandGroup(); | |
const bug_channel = '823321914415251486'; //channel with bug reports | |
const feedback_channel = '823329566386028584'; // feedback channel | |
const role = '823321334598860801'; //role with perms to report bugs | |
commands.on( | |
'bug', | |
(args) => ({ text: args.text() }), | |
async (message, { text }) => { | |
if (!message.member.roles.includes(role)) { | |
return await message.reply( | |
'You need to be a beta tester to use this command!' | |
); | |
} | |
let pieces = text.split('|'); | |
if (pieces.length < 5) { | |
return await message.reply( | |
'Invalid format! Make sure to divide all (5) required sections with a `|`' | |
); | |
} | |
let title = pieces[0]; | |
let description = pieces[1]; | |
let reproduce = pieces[2]; | |
let expectation = pieces[3]; | |
let reality = pieces[4]; | |
const channel = await discord | |
.getGuild() | |
.then((x) => x.getChannel(bug_channel)); | |
await channel?.sendMessage({ | |
embed: new discord.Embed({ | |
title: title, | |
description: `**Description:**\n${description}\n**Steps to reproduce:**\n${reproduce}\n**Expectation:**\n${expectation}\n**Reality:**\n${reality}`, | |
color: discord.decor.RoleColors.RED, | |
footer: { | |
text: `Reported by ${message.author.getTag()}`, | |
iconUrl: message.author.getAvatarUrl() | |
} | |
}) | |
}); | |
await message.delete(); | |
await message.reply( | |
discord.decor.Emojis.WHITE_CHECK_MARK + | |
' Successfully submitted bug report' | |
); | |
} | |
); | |
commands.on( | |
'confirm', | |
(args) => ({ id: args.string() }), | |
async (message, { id }) => { | |
if (!message.member.roles.includes(role)) { | |
return await message.reply( | |
'You need to be a beta tester to use this command!' | |
); | |
} | |
const channel = await discord | |
.getGuild() | |
.then((x) => x.getChannel(bug_channel)); | |
try { | |
var msg = await channel?.getMessage(id); | |
} catch { | |
return await message.reply('Invalid message id'); | |
} | |
if (msg.embeds[0].color == discord.decor.RoleColors.GREEN) { | |
return await message.reply('This bug is market as fixed!'); | |
} | |
msg.edit({ | |
embed: new discord.Embed({ | |
title: msg.embeds[0].title!, | |
description: | |
msg.embeds[0].description + | |
'\n' + | |
discord.decor.Emojis.WHITE_CHECK_MARK + | |
' reproducable by `' + | |
message.author.getTag() + | |
'`\n', | |
color: discord.decor.RoleColors.RED, | |
footer: msg.embeds[0].footer! | |
}) | |
}); | |
await message.reply('Successfully confirmed bug report ' + id); | |
} | |
); | |
commands.on( | |
'deny', | |
(args) => ({ id: args.string() }), | |
async (message, { id }) => { | |
if (!message.member.roles.includes(role)) { | |
return await message.reply( | |
'You need to be a beta tester to use this command!' | |
); | |
} | |
const channel = await discord | |
.getGuild() | |
.then((x) => x.getChannel(bug_channel)); | |
try { | |
var msg = await channel?.getMessage(id); | |
} catch { | |
return await message.reply('Invalid message id'); | |
} | |
if (msg.embeds[0].color == discord.decor.RoleColors.GREEN) { | |
return await message.reply('This bug is market as fixed!'); | |
} | |
msg.edit({ | |
embed: new discord.Embed({ | |
title: msg.embeds[0].title!, | |
description: | |
msg.embeds[0].description + | |
'\n' + | |
discord.decor.Emojis.X + | |
' not reproducable by `' + | |
message.author.getTag() + | |
'`\n', | |
color: discord.decor.RoleColors.RED, | |
footer: msg.embeds[0].footer! | |
}) | |
}); | |
await message.reply('Successfully denied bug report ' + id); | |
} | |
); | |
commands.on( | |
'fixed', | |
(args) => ({ id: args.string() }), | |
async (message, { id }) => { | |
if (!message.member.roles.includes('730088391424606328')) { //admin role, was too lazy to make it a const | |
return await message.reply( | |
'You need to be an admin to use this command!' | |
); | |
} | |
const channel = await discord | |
.getGuild() | |
.then((x) => x.getChannel(bug_channel)); | |
try { | |
var msg = await channel?.getMessage(id); | |
} catch { | |
return await message.reply('Invalid message id'); | |
} | |
msg.edit({ | |
embed: new discord.Embed({ | |
title: msg.embeds[0].title!, | |
description: | |
msg.embeds[0].description + | |
'\n' + | |
'<:status_online:812486303823822848> marked as fixed by `' + | |
message.author.getTag() + | |
'`', | |
color: discord.decor.RoleColors.GREEN, | |
footer: msg.embeds[0].footer! | |
}) | |
}); | |
await message.reply('Successfully closed bug report ' + id); | |
} | |
); | |
commands.on( | |
'reopen', | |
(args) => ({ id: args.string() }), | |
async (message, { id }) => { | |
if (!message.member.roles.includes('730088391424606328')) { //admin role, was too lazy to make it a const | |
return await message.reply( | |
'You need to be an admin to use this command!' | |
); | |
} | |
const channel = await discord | |
.getGuild() | |
.then((x) => x.getChannel(bug_channel)); | |
try { | |
var msg = await channel?.getMessage(id); | |
} catch { | |
return await message.reply('Invalid message id'); | |
} | |
msg.edit({ | |
embed: new discord.Embed({ | |
title: msg.embeds[0].title!, | |
description: | |
msg.embeds[0].description + | |
'\n' + | |
'<:status_dnd:812486370940551189> reopened by `' + | |
message.author.getTag() + | |
'`', | |
color: discord.decor.RoleColors.RED, | |
footer: msg.embeds[0].footer! | |
}) | |
}); | |
await message.reply('Successfully reopened bug report ' + id); | |
} | |
); | |
commands.on( | |
{ name: 'fb', aliases: ['feedback'] }, | |
(args) => ({ text: args.text() }), | |
async (message, { text }) => { | |
const channel = await discord | |
.getGuild() | |
.then((x) => x.getChannel(feedback_channel)); | |
if (!message.member.roles.includes(role)) { | |
return await message.reply( | |
'You need to be a beta tester to use this command!' | |
); | |
} | |
let pieces = text.split('|'); | |
if (pieces.length < 2) { | |
return await message.reply( | |
'Invalid format! Make sure to divide all required (2) sections with a `|`' | |
); | |
} | |
let title = text[0]; | |
let description = text[1]; | |
let msg = await channel?.sendMessage({ | |
embed: new discord.Embed({ | |
title: title, | |
description: description, | |
color: discord.decor.RoleColors.GREEN, | |
footer: { | |
iconUrl: message.author.getAvatarUrl(), | |
text: 'Suggested by ' + message.author.getTag() | |
} | |
}) | |
}); | |
await msg.addReaction(discord.decor.Emojis.WHITE_CHECK_MARK); | |
await msg.addReaction(discord.decor.Emojis.X); | |
await message.delete(); | |
await message.reply('Successfully submitted feedback!'); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment