This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
221 additions
and
53 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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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,126 @@ | ||
const emoji = require("../../config.json").emojis; | ||
|
||
const donatorSchema = require("../../models/donatorSchema"); | ||
|
||
module.exports = { | ||
name: "donator", | ||
description: "Manage the donator role.", | ||
options: [ | ||
{ | ||
type: 1, | ||
name: "add", | ||
description: "[OWNER ONLY] Add a user to the donator role.", | ||
options: [ | ||
{ | ||
type: 6, | ||
name: "user", | ||
description: "The user to add.", | ||
required: true | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
type: 1, | ||
name: "remove", | ||
description: "[OWNER ONLY] Remove a user from the donator role.", | ||
options: [ | ||
{ | ||
type: 6, | ||
name: "user", | ||
description: "The user to remove.", | ||
required: true | ||
} | ||
] | ||
} | ||
], | ||
default_member_permissions: null, | ||
botPermissions: [], | ||
requiredRoles: ["owner"], | ||
cooldown: 0, | ||
enabled: true, | ||
hidden: true, | ||
deferReply: true, | ||
ephemeral: true, | ||
async execute(interaction, client, Discord) { | ||
try { | ||
const logsChannel = client.channels.cache.get(client.config_channels.logs); | ||
const user = interaction.options.getUser("user"); | ||
|
||
if(interaction.options.getSubcommand() === "add") { | ||
if(user.bot) { | ||
const error = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.error) | ||
.setDescription(`${emoji.cross} You cannot make a bot a donator!`) | ||
|
||
await interaction.editReply({ embeds: [error] }); | ||
return; | ||
} | ||
|
||
if(await donatorSchema.exists({ _id: user.id })) { | ||
const error = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.error) | ||
.setDescription(`${emoji.cross} ${user} is already a donator!`) | ||
|
||
await interaction.editReply({ embeds: [error] }); | ||
return; | ||
} | ||
|
||
new donatorSchema({ _id: user.id }).save(); | ||
|
||
const added = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.default) | ||
.setDescription(`${emoji.tick} ${user} has been added to the donator role.`) | ||
|
||
await interaction.editReply({ embeds: [added] }); | ||
|
||
const log = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.default) | ||
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` }) | ||
.setTitle("Role Added") | ||
.addFields ( | ||
{ name: "🎭 Role", value: "💸 Donator" }, | ||
{ name: "👤 User", value: `${user}` } | ||
) | ||
.setTimestamp() | ||
|
||
logsChannel.send({ embeds: [log] }); | ||
return; | ||
} | ||
|
||
if(interaction.options.getSubcommand() === "remove") { | ||
if(!await donatorSchema.exists({ _id: user.id })) { | ||
const error = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.error) | ||
.setDescription(`${emoji.cross} ${user} is not a donator!`) | ||
|
||
await interaction.editReply({ embeds: [error] }); | ||
return; | ||
} | ||
|
||
await donatorSchema.findOneAndDelete({ _id: user.id }); | ||
|
||
const removed = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.default) | ||
.setDescription(`${emoji.tick} ${user} has been removed from the donator role.`) | ||
|
||
await interaction.editReply({ embeds: [removed] }); | ||
|
||
const log = new Discord.EmbedBuilder() | ||
.setColor(client.config_embeds.default) | ||
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` }) | ||
.setTitle("Role Removed") | ||
.addFields ( | ||
{ name: "🎭 Role", value: "💸 Donator" }, | ||
{ name: "👤 User", value: `${user}` } | ||
) | ||
.setTimestamp() | ||
|
||
logsChannel.send({ embeds: [log] }); | ||
return; | ||
} | ||
} catch(err) { | ||
client.logCommandError(err, interaction, Discord); | ||
} | ||
} | ||
} |
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
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,7 @@ | ||
const mongoose = require("mongoose"); | ||
|
||
const schema = new mongoose.Schema({ | ||
_id: String | ||
}) | ||
|
||
module.exports = mongoose.model("donators", schema, "donators") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.