I did some work at school and need to save it hi github

oh also you're welcome mini, i changed the colours
pull/5/head
PineappleFan 4 years ago committed by GitHub
parent 797c86061d
commit 19b002b66d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -227,7 +227,7 @@ const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
// Check if Nucleus has permission to mute
if (! interaction.guild.me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the `moderate_members` permission";
// Do not allow the user to have admin or be the owner
if (apply.permissions.has("ADMINISTRATOR") || apply.id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
if ((interaction.options.getMember("user") as GuildMember).permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
// Do not allow muting Nucleus
if (member.id == interaction.guild.me.id) throw "I cannot mute myself"
// Allow the owner to mute anyone

@ -1,57 +1,53 @@
import humanizeDuration from 'humanize-duration';
import { CommandInteraction, GuildMember, TextChannel } from "discord.js";
import { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import keyValueList from "../../utils/generateKeyValueList.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
import humanizeDuration from 'humanize-duration';
const command = (builder: SlashCommandSubcommandBuilder) =>
builder
.setName("slowmode")
.setDescription("Manages slowmode in a channel")
.addStringOption(option => option.setName("time").setDescription("The delay between messages").setRequired(false).addChoices([
["Off", "0"],
["5 seconds", "5"], ["10 seconds", "10"], ["15 seconds", "15"], ["30 seconds", "30"],
["1 minute", "60"], ["2 minutes", "120"], ["5 minutes", "300"], ["10 minutes", "600"],
["15 minutes", "900"], ["30 minutes", "1800"],
["1 hour", "3600"], ["2 hours", "7200"], ["6 hours", "21600"]
]))
.addIntegerOption(option => option.setName("seconds").setDescription("The seconds between messages").setRequired(false))
.addIntegerOption(option => option.setName("minutes").setDescription("The minutes between messages").setRequired(false))
.addIntegerOption(option => option.setName("hours").setDescription("The hours between messages").setRequired(false))
const callback = (interaction: CommandInteraction) => {
let seconds = interaction.option.getInteger("seconds")
let minutes = interaction.option.getInteger("minutes")
let hours = interaction.option.getInteger("hours")
let totalTime = seconds + (minutes * 60) + (hours * 60 * 60)
const callback = async (interaction: CommandInteraction) => {
let time = parseInt(interaction.options.getString("time") ?? "0");
if (time === 0 && (interaction.channel as TextChannel).rateLimitPerUser === 0) { time = 10 }
let confirmation = await new confirmationMessage(interaction)
.setEmoji("CHANNEL.SLOWMODE.RED")
.setEmoji("PUNISH.SLOWMODE.RED")
.setTitle("Slowmode")
.setDescription(keyValueList({
"time": time ? humanizeDuration(time * 1000, { round: true }) : "No delay",
"delay": `${totalTime ? humanizeDuration(totalTime * 1000) : "*No delay*"}`
})
+ `Are you sure you want to set the slowmode in this channel?`)
+ `Are you sure you want to enable slowmode in this channel?`)
.setColor("Danger")
// pluralize("day", interaction.options.getInteger("delete"))
// const pluralize = (word: string, count: number) => { return count === 1 ? word : word + "s" }
.send()
if (confirmation.success) {
try {
(interaction.channel as TextChannel).setRateLimitPerUser(time)
} catch (e) {
await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.SLOWMODE.RED")
await interaction.setRateLimitPerUser(totalTime, "Nucleus slowmode")
} catch {
return await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("PUNISH.SLOWMODE.RED")
.setTitle(`Slowmode`)
.setDescription("An error occurred while setting the slowmode")
.setDescription("Something went wrong and the slowmode could not be set.")
.setStatus("Danger")
], components: []})
}
await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji(`CHANNEL.SLOWMODE.GREEN`)
.setEmoji("PUNISH.NICKNAME.GREEN")
.setTitle(`Slowmode`)
.setDescription("The channel slowmode was set successfully")
.setStatus("Success")
], components: []})
} else {
await interaction.editReply({embeds: [new generateEmojiEmbed()
.setEmoji("CHANNEL.SLOWMODE.GREEN")
.setEmoji("PUNISH.SLOWMODE.GREEN")
.setTitle(`Slowmode`)
.setDescription("No changes were made")
.setStatus("Success")
@ -61,9 +57,12 @@ const callback = async (interaction: CommandInteraction) => {
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as GuildMember)
// Check if Nucleus can set the slowmode
if (! interaction.guild.me.permissions.has("MANAGE_CHANNELS")) throw "I do not have the `manage_channels` permission";
// Check if the user has manage_channel permission
let me = (interaction.guild.me as GuildMember)
// Check if Nucleus can edit the channel
if (! interaction.guild.me.permission.has("MANAGE_CHANNELS")) throw "I do not have permission to edit this channel"
// Allow the owner to set any channel
if (member.id == interaction.guild.ownerId) return true
// Check if the user has manage_channels permission
if (! member.permissions.has("MANAGE_CHANNELS")) throw "You do not have the `manage_channels` permission";
// Allow slowmode
return true

@ -88,6 +88,7 @@ const callback = async (interaction: CommandInteraction) => { // TODO: User sear
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as GuildMember)
let me = (interaction.guild.me as GuildMember)
// Check if Nucleus can unban members
if (! interaction.guild.me.permissions.has("BAN_MEMBERS")) throw "I do not have the `ban_members` permission";
// Allow the owner to unban anyone

@ -89,7 +89,7 @@ const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
// Check if Nucleus has permission to unmute
if (! interaction.guild.me.permissions.has("MODERATE_MEMBERS")) throw "I do not have the `moderate_members` permission";
// Do not allow the user to have admin or be the owner
if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
if ((interaction.options.getMember("user") as GuildMember).permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot unmute an admin or the owner"
// Allow the owner to unmute anyone
if (member.id == interaction.guild.ownerId) return true
// Check if the user has moderate_members permission

@ -217,7 +217,7 @@ const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
// Check if Nucleus has permission to UNNAMED
if (! interaction.guild.me.permissions.has("MANAGE_ROLES")) throw "I do not have the `manage_roles` permission";
// Do not allow the user to have admin or be the owner
if (apply.permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
if ((interaction.options.getMember("user") as GuildMember).permissions.has("ADMINISTRATOR") || (interaction.options.getMember("user") as GuildMember).id == interaction.guild.ownerId) throw "You cannot mute an admin or the owner"
// Do not allow muting Nucleus
if (member.id == interaction.guild.me.id) throw "I cannot UNNAMED myself"
// Allow the owner to UNNAMED anyone

@ -20,6 +20,7 @@ const callback = async (interaction: CommandInteraction) => {
.setDescription(`**Suggestion:**\n> ${suggestion}\n`
+ `Your username and ID will also be sent with your suggestion.\n\nAre you sure you want to send this suggestion?`)
.setColor("Danger")
.setInverted(true)
.send()
if (confirmation.success) {
await (interaction.client.channels.cache.get('955161206459600976') as Discord.TextChannel).send({

@ -162,10 +162,11 @@ const callback = async (interaction: CommandInteraction) => {
}
const check = (interaction: CommandInteraction, defaultCheck: WrappedCheck) => {
let member = (interaction.member as GuildMember)
// Allow the owner to promote anyone
if ((interaction.member as GuildMember).id == interaction.guild.ownerId) return true
if (member.id == interaction.guild.ownerId) return true
// Check if the user has manage_roles permission
if (! (interaction.member as GuildMember).permissions.has("MANAGE_ROLES")) throw "You do not have the `manage_roles` permission";
if (! member.permissions.has("MANAGE_ROLES")) throw "You do not have the `manage_roles` permission";
// Allow track
return true // TODO: allow if the member has manage perms
}

@ -0,0 +1,352 @@
{
"NUCLEUS": {
"LOGO": "953040840945721385",
"LOADING": "a946346549271732234",
"INFO": {
"HELP": "751751467014029322",
"ABOUT": "751762088346517504",
"COMMANDS": "751762088229339136",
"SUPPORT": "751762087780286495"
},
"COMMANDS": {
"RAID": "777143043711172608",
"LOCK": "776848800995868682",
"IGNORE": "777520659270074389"
}
},
"ICONS": {
"ADD": "826823514904330251",
"REMOVE": "826823515268186152",
"OPP": {
"ADD": "837355918831124500",
"REMOVE": "837355918420869162"
},
"CHANNEL": {
"TEXT": "752971441351426089",
"VOICE": "752971441586307091",
"STORE": "853668786925469706",
"ANNOUNCEMENT": "853668786493063169",
"STAGE": "853668786842763294"
}
},
"CONTROL": {
"TICK": "947441964234702849",
"CROSS": "947441948543815720",
"BLOCKCROSS": "952261738349330493",
"LEFT": "947441951148486728",
"RIGHT": "947441957473488916",
"UP": "963409197293273108",
"DOWN": "963409199549796352",
"DOWNLOAD": "947959513032585236",
"TICKET": "973253514488860683",
"PILL": {
"TICK": "753314339082993832",
"CROSS": "753314339389309100"
}
},
"STATUS": {
"ONLINE": "729064530084102166",
"IDLE": "729064531577536582",
"DND": "729064531057311886",
"STREAMING": "729764055082074153",
"OFFLINE": "729064531271221289"
},
"CHANNEL": {
"TEXT": {
"CREATE": "729066924943737033",
"EDIT": "951957316117360640",
"DELETE": "729064529211686922"
},
"VOICE": {
"CREATE": "729064530830950530",
"EDIT": "951957316071223336",
"DELETE": "729064530981683200"
},
"STORE": {
"CREATE": "729064530709315715",
"DELETE": "729064530768035922"
},
"CATEGORY": {
"CREATE": "787987508465238026",
"EDIT": "787987508565770300",
"DELETE": "787987508507967488"
},
"PURGE": {
"RED": "729064530797133875",
"GREEN": "947443645391441940"
},
"TITLEUPDATE": "729763053620691044",
"TOPICUPDATE": "729763053477953536",
"SLOWMODE": {
"ON": "777138171301068831",
"OFF": "777138171447869480",
"//TODO": "// TODO"
},
"NSFW": {
"ON": "729064531208175736",
"OFF": "729381430991388752"
}
},
"MEMBER": {
"JOIN": "729066519337762878",
"LEAVE": "729064531170558575",
"BOT": {
"JOIN": "729064528666689587",
"LEAVE": "729064528998039633"
},
"KICK": "729263536785850458",
"BAN": "729263536643112991",
"UNBAN": "729263536840114216"
},
"INVITE": {
"CREATE": "729064529274601482",
"DELETE": "729064531103580230"
},
"WEBHOOK": {
"CREATE": "752070251906203679",
"UPDATE": "752073772823216191",
"DELETE": "752070251948146768"
},
"MESSAGE": {
"EDIT": "729065958584614925",
"DELETE": "729064530432360461",
"PIN": "729064530755190894",
"REACTION": {
"ADD": "",
"REMOVE": "",
"CLEAR": "729064531468353606"
},
"PING": {
"MASS": "729620608408879124",
"EVERYONE": "729064531073957909",
"ROLE": "729263536915742770"
}
},
"PUNISH": {
"WARN": {
"RED": "947433493384806430",
"GREEN": "947433504076091424",
"YELLOW": "729764054897524768"
},
"KICK": {
"RED": "729764053794422896",
"GREEN": "947428786692042764",
"YELLOW": "947429333289562132"
},
"BAN": {
"RED": "729764053861400637",
"GREEN": "947421674364629022",
"YELLOW": "729764053941223476"
},
"UNBAN": {
"GREEN": "729263536840114216",
"YELLOW": "972511620343414794",
"RED": "972511610885255259"
},
"MUTE": {
"RED": "947555098974883910",
"GREEN": "947555107980066866",
"YELLOW": "729764053865463840"
},
"SOFTBAN": "729764053941223476",
"VOICEMUTE": "729764054855450697",
"CLEARHISTORY": "729764062270980096",
"NICKNAME": {
"RED": "959762533101731980",
"YELLOW": "729064531019694090",
"GREEN": "959762533072392202"
}
},
"BADGES": {
"NUCLEUSDEVELOPER": "957722888360853595",
"CLICKSDEVELOPER": "957722888314683462",
"HOUSE_BRAVERY": "775783765930016789",
"HOUSE_BRILLIANCE": "775783766152577095",
"HOUSE_BALANCE": "775783766303440937",
"HYPESQUAD_EVENTS": "775783766194126908",
"EARLY_SUPPORTER": "775783766055452693",
"BUGHUNTER_LEVEL_1": "775783766252847154",
"BUGHUNTER_LEVEL_2": "775783766130950234",
"PARTNERED_SERVER_OWNER": "775783766178005033",
"DISCORD_EMPLOYEE": "775783766383788082",
"EARLY_VERIFIED_BOT_DEVELOPER": "775783766425600060",
"BOT": "776375959108190239",
"BOOSTER": "775783766131605545"
},
"VOICE": {
"CONNECT": "784785219391193138",
"CHANGE": "784785219353968670",
"LEAVE": "784785219432480808",
"MUTE": "784785219613360149",
"UNMUTE": "784785219441524766",
"DEAFEN": "784785219424747550",
"UNDEAFEN": "784785219324346378",
"STREAM": {
"START": "853519659775819787",
"STOP": "853519660116213780"
},
"VIDEO": {
"START": "853519659945295873",
"STOP": "853519660116738078"
}
},
"GUILD": {
"RED": "959779988264079361",
"YELLOW": "729763053352124529",
"GREEN": "959779988503154698",
"EMOJI": {
"CREATE": "953035168115982437",
"EDIT": "729066518549233795",
"DELETE": "953035210121953320"
},
"GRAPHS": "752214059159650396",
"SETTINGS": "752570111063228507",
"ICONCHANGE": "729763053612302356",
"TICKET": {
"OPEN": "853245836331188264",
"CLOSE": "853580122506133505",
"ARCHIVED": "853580122636025856"
},
"ROLES": {
"CREATE": "729064530763579413",
"DELETE": "729064530885476392",
"EDIT": "776109664793919489",
"MEMBERS": "752570111281594509",
"MESSAGES": "752570111373606942",
"VOICE": "752570111088525354"
}
},
"MOD": {
"IMAGES": {
"SWEARING": "730438422627614810",
"INVISIBLE": "730438422690398238",
"TOOBIG": "730438422921084998",
"TOOSMALL": "730438422921216150"
},
"SWEARING": "730438422816096377",
"SPAM": "730438422853845042"
},
"NUMBERS": [
{
"NORMAL": "753259024404840529",
"GREEN": "753312608378945648",
"RED": "753312608890650664"
},
{
"NORMAL": "753259025990418515",
"GREEN": "753312608550912112",
"RED": "753312609075462246"
},
{
"NORMAL": "753259024409034896",
"GREEN": "753312608513294366",
"RED": "753312608680935446"
},
{
"NORMAL": "753259024358703205",
"GREEN": "753312608815284426",
"RED": "753312609377320966"
},
{
"NORMAL": "753259024555835513",
"GREEN": "753312608735461457",
"RED": "753312609255686223"
},
{
"NORMAL": "753259024744579283",
"GREEN": "753312608630604017",
"RED": "753312609138376777"
},
{
"NORMAL": "753259024354639994",
"GREEN": "753312608656031806",
"RED": "753312609465270412"
},
{
"NORMAL": "753259024530800661",
"GREEN": "753312608718815322",
"RED": "753312609104822313"
},
{
"NORMAL": "753259024895574037",
"GREEN": "753312608790249646",
"RED": "753312609477984319"
},
{
"NORMAL": "753259024681533553",
"GREEN": "753312608899170365",
"RED": "753312609557545089"
}
],
"BOTS": {
"GPS": "878919163937185803",
"NUCLEUS": "878919163597439016",
"CLICKSFORMS": "878919163337388073",
"CASTAWAY": "878919164255944726",
"CMPING": "878919164125929502",
"HOOKY": "878919164121731082"
},
"CFSERVICE": {
"VERIFIED": "881984571242053642",
"UNVERIFIED": "881984571258847232"
},
"TICKETS": {
"SUPPORT": "952295894370369587",
"REPORT": "952295894437482537",
"QUESTION": "952295894403907645",
"ISSUE": "952295894412316672",
"SUGGESTION": "952295894399725588",
"OTHER": "952295894445883502"
},
"TRACKS": {
"ICON": "963170616444334171",
"HORIZONTAL": {
"LEFT": {
"ACTIVE": "963121920038035506",
"INACTIVE": "963121944239153242"
},
"MIDDLE": {
"ACTIVE": "963121925893263420",
"INACTIVE": "963121949796597870"
},
"RIGHT": {
"ACTIVE": "963121933384302602",
"INACTIVE": "963121956125831168"
}
},
"VERTICAL": {
"TOP": {
"ACTIVE": "963122664648630293",
"INACTIVE": "963122659862917140",
"GREY": {
"ACTIVE": "963123505052934144",
"INACTIVE": "963123495221469194"
}
},
"MIDDLE": {
"ACTIVE": "963122679332880384",
"INACTIVE": "963122673246937199",
"GREY": {
"ACTIVE": "963123517702955018",
"INACTIVE": "963123511927390329"
}
},
"BOTTOM": {
"ACTIVE": "963122691752218624",
"INACTIVE": "963122685691453552",
"GREY": {
"ACTIVE": "963123529988059187",
"INACTIVE": "963123523742748742"
}
}
},
"SINGLE": {
"ACTIVE": "963361162215424060",
"INACTIVE": "963361431758176316",
"GREY": {
"ACTIVE": "963361204695334943",
"INACTIVE": "963361200828198952"
}
}
}
}

@ -14,6 +14,7 @@ class confirmationMessage {
customCallbackString: string = "";
customCallbackClicked: boolean = false;
customCallbackResponse: any = null;
inverted: boolean;
constructor(interaction: CommandInteraction) {
this.interaction = interaction;
@ -22,6 +23,7 @@ class confirmationMessage {
this.emoji = "";
this.description = "";
this.color = "";
this.inverted = false
this.customCallback = () => {}
}
@ -52,13 +54,13 @@ class confirmationMessage {
new MessageActionRow().addComponents([
new Discord.MessageButton()
.setCustomId("yes")
.setLabel("Yes")
.setStyle("SUCCESS")
.setLabel("Confirm")
.setStyle(this.inverted ? "SUCCESS" : "DANGER")
.setEmoji(getEmojiByName("CONTROL.TICK", "id")),
new Discord.MessageButton()
.setCustomId("no")
.setLabel("Cancel")
.setStyle("DANGER")
.setStyle(this.inverted ? "DANGER" : "SUCCESS")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
].concat(this.customButtonTitle ? [new Discord.MessageButton()
.setCustomId("custom")
@ -81,14 +83,14 @@ class confirmationMessage {
try {
component = await (m as Message).awaitMessageComponent({filter: (m) => m.user.id === this.interaction.user.id, time: 2.5 * 60 * 1000});
} catch (e) {
return {success: false, buttonClicked: this.customCallbackClicked, response: this.customCallbackResponse};
return { success: false, buttonClicked: this.customCallbackClicked, response: this.customCallbackResponse };
}
if (component.customId === "yes") {
component.deferUpdate();
return {success: true, buttonClicked: this.customCallbackClicked, response: this.customCallbackResponse};
return { success: true, buttonClicked: this.customCallbackClicked, response: this.customCallbackResponse };
} else if (component.customId === "no") {
component.deferUpdate();
return {success: false, buttonClicked: this.customCallbackClicked, response: this.customCallbackResponse};
return { success: false, buttonClicked: this.customCallbackClicked, response: this.customCallbackResponse };
} else if (component.customId === "custom") {
component.deferUpdate();
this.customCallbackResponse = this.customCallback();

Loading…
Cancel
Save