Skip to content

Commit

Permalink
Merge pull request #88 from RainyXeon/dev
Browse files Browse the repository at this point in the history
feat: admin on ByteBlaze
  • Loading branch information
RainyXeon authored May 8, 2024
2 parents 5749630 + 7b3c738 commit e9a4914
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
3 changes: 3 additions & 0 deletions example.full.app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bot:
TOKEN: "Bot Token"
EMBED_COLOR: "#2B2D31"
OWNER_ID: "Your User ID"
ADMIN: ["<your_trusted_admin_discord_id_here>"]
LANGUAGE: "en" # You can set it to en, vi...
LIMIT_TRACK: 50 # The number of tracks you want to limit
LIMIT_PLAYLIST: 20 # The number of playlist you want to limit
Expand Down Expand Up @@ -86,3 +87,5 @@ features:
WEB_SERVER:
enable: false
port: 3000
whitelist: [] # Example: ["lavalink.dev"]
auth: "youshallnotpass"
1 change: 1 addition & 0 deletions src/@types/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface Bot {
TOKEN: string;
EMBED_COLOR: string;
OWNER_ID: string;
ADMIN: string[];
LANGUAGE: string;
LIMIT_TRACK: number;
LIMIT_PLAYLIST: number;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Owner/Announcement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class implements Command {
public name = ["announcement"];
public description = "Send announcement mesage to all server";
public category = "Owner";
public accessableby = Accessableby.Owner;
public accessableby = Accessableby.Admin;
public usage = "<your_message>";
public aliases = ["an"];
public lavalink = false;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Premium/Generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class implements Command {
public name = ["pm-generate"];
public description = "Generate a premium code!";
public category = "Premium";
public accessableby = Accessableby.Owner;
public accessableby = Accessableby.Admin;
public usage = "<type> <number>";
public aliases = [];
public lavalink = false;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Premium/Remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class implements Command {
public name = ["pm-remove"];
public description = "Remove premium from members!";
public category = "Premium";
public accessableby = Accessableby.Owner;
public accessableby = Accessableby.Admin;
public usage = "<id>";
public aliases = ["prm"];
public lavalink = false;
Expand Down
22 changes: 20 additions & 2 deletions src/events/guild/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,25 @@ export default class {
],
});

if (command.accessableby == Accessableby.Voter && isHavePremium && client.topgg) {
if (
command.accessableby == Accessableby.Admin &&
interaction.user.id != client.owner &&
!client.config.bot.ADMIN.includes(interaction.user.id)
)
return interaction.reply({
embeds: [
new EmbedBuilder()
.setDescription(`${client.getString(language, "error", "no_perms", { perm: "dreamvast@admin" })}`)
.setColor(client.color),
],
});

if (
command.accessableby == Accessableby.Voter &&
isHavePremium &&
client.topgg &&
interaction.user.id != client.owner
) {
const voteChecker = await client.topgg.checkVote(interaction.user.id);
if (voteChecker == TopggServiceEnum.ERROR) {
const embed = new EmbedBuilder()
Expand Down Expand Up @@ -199,7 +217,7 @@ export default class {
}
}

if (command.accessableby == Accessableby.Premium && isHavePremium) {
if (command.accessableby == Accessableby.Premium && isHavePremium && interaction.user.id != client.owner) {
const embed = new EmbedBuilder()
.setAuthor({
name: `${client.getString(language, "error", "no_premium_author")}`,
Expand Down
1 change: 1 addition & 0 deletions src/services/ConfigDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class ConfigDataService {
SAFE_ICONS_MODE: true,
DELETE_MSG_TIMEOUT: 2000,
DEBUG_MODE: false,
ADMIN: [],
},
lavalink: {
SPOTIFY: {
Expand Down

0 comments on commit e9a4914

Please sign in to comment.