Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Discordv14 #67

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/Archive/ClearQueue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
import { colorCheck } from '../resources/embedColorCheck';
import { SlashCommand } from './SlashCommand';

export class ClearQueue implements SlashCommand {
name: string = 'clearqueue';
description = 'Clear the music queue';
options = [];
requiredPermissions: bigint[] = [];
async run(bot: Bot, interaction: CommandInteraction<CacheType>): Promise<void> {
try {
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
embed.setDescription(
'There are no songs in the queue or the player is not playing'
);
interaction.reply({ embeds: [embed], ephemeral: true });
return;
}
queue.clear();
embed.setDescription(`Queue has been cleared by ${interaction.user}`);
interaction.reply({ embeds: [embed] });
return;
} catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
interaction.reply({
content: 'Error: contact a developer to investigate',
ephemeral: true,
});
return;
}
}
guildRequired?: boolean | undefined = true;
managerRequired?: boolean | undefined;
blockSilenced?: boolean | undefined = true;
musicCommand?: boolean | undefined = true;
}
File renamed without changes.
32 changes: 32 additions & 0 deletions docs/Archive/DestroyQueue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { CommandInteraction, CacheType } from 'discord.js';
import { Bot } from '../Bot';
import { Option, Subcommand } from './Option';
import { SlashCommand } from './SlashCommand';

export class DestroyQueue implements SlashCommand {
name: string = 'destroyqueue';
description: string = 'Empty and destroy the queue, will reset the music player entirely';
options: (Option | Subcommand)[] = [];
requiredPermissions: bigint[] = [];
run(bot: Bot, interaction: CommandInteraction<CacheType>): Promise<void> {
try {
let queue = bot.player.getQueue(interaction.guild!.id);
if (queue) {
queue.destroy();
}
interaction.reply('Reset the queue');
return;
} catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
interaction.reply({
content: 'Error: contact a developer to investigate',
ephemeral: true,
});
return;
}
}
guildRequired?: boolean | undefined = true;
managerRequired?: boolean | undefined;
blockSilenced?: boolean | undefined = true;
musicCommand?: boolean | undefined = true;
}
45 changes: 45 additions & 0 deletions docs/Archive/Loop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { QueueRepeatMode, Track } from "discord-player";
import { CommandInteraction, CacheType, EmbedBuilder } from "discord.js";
import { Bot } from "../Bot";
import { colorCheck } from "../resources/embedColorCheck";
import { Option, Subcommand } from "./Option";
import { SlashCommand } from "./SlashCommand";

export class Loop implements SlashCommand{
name: string = 'loop';
description: string = 'Loop the song that is currently playing';
options: (Option | Subcommand)[] = [];
requiredPermissions: bigint[] = [];
run(bot: Bot, interaction: CommandInteraction<CacheType>): Promise<void> {
try {
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id));

let queue = bot.player.getQueue(interaction.guild!.id);
if(!queue || !queue.playing) {
embed.setDescription('There is no music playing!');
interaction.reply({embeds: [embed]});
return;
}
if(queue.repeatMode){
embed.setDescription('Stopped looping');
queue.setRepeatMode(QueueRepeatMode.OFF);
return interaction.reply({embeds: [embed]});
}
queue.setRepeatMode(QueueRepeatMode.TRACK);
embed.setDescription(`Now looping **${queue.nowPlaying().title}** by *${queue.nowPlaying().author}*. Use \`/skip\` to continue the queue`);
return interaction.reply({embeds:[embed]});
}
catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
return interaction.reply({
content: 'Error: contact a developer to investigate',
ephemeral: true,
});
}
}
guildRequired?: boolean | undefined = true;
managerRequired?: boolean | undefined;
blockSilenced?: boolean | undefined = true;
musicCommand?: boolean | undefined = true;

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
MessageEmbed,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
Expand All @@ -16,7 +16,7 @@ export class NowPlaying implements SlashCommand {
requiredPermissions: bigint[] = [];
run(bot: Bot, interaction: CommandInteraction<CacheType>): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
Expand Down
47 changes: 47 additions & 0 deletions docs/Archive/Pause.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {
CommandInteraction,
CacheType,
EmbedBuilder,
} from 'discord.js';
import { Bot } from '../Bot';
import { colorCheck } from '../resources/embedColorCheck';
import { SlashCommand } from './SlashCommand';


export class Pause implements SlashCommand {
name: string = 'pause';
description: string = 'Pause the music player';
options = [];
requiredPermissions: bigint[] = [];
async run(
bot: Bot,
interaction: CommandInteraction<CacheType>
): Promise<void> {
try {
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));


let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
embed.setDescription('There is no music playing!');
interaction.reply({ embeds: [embed], ephemeral: true });
return;
}
queue.setPaused(true);
embed.setDescription(`Music was paused by ${interaction.user}`);
interaction.reply({ embeds: [embed] });
return;
} catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
interaction.reply({
content: 'Error: contact a developer to investigate',
ephemeral: true,
});
return;
}
}
guildRequired?: boolean | undefined = true;
managerRequired?: boolean | undefined;
blockSilenced?: boolean | undefined = true;
musicCommand?: boolean | undefined = true;
}
8 changes: 4 additions & 4 deletions src/slashcommands/Play.ts → docs/Archive/Play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
MessageEmbed,
EmbedBuilder,
GuildMember,
ApplicationCommandOptionType,
} from 'discord.js';
import { ApplicationCommandOptionTypes } from 'discord.js/typings/enums';
import { Bot } from '../Bot';
import { SlashCommand } from './SlashCommand';
import { QueryType } from 'discord-player';
Expand All @@ -20,7 +20,7 @@ export class Play implements SlashCommand {
new Option(
'query',
'The song or playlist you want to queue',
ApplicationCommandOptionTypes.STRING,
ApplicationCommandOptionType.String,
true
),
];
Expand All @@ -30,7 +30,7 @@ export class Play implements SlashCommand {
interaction: CommandInteraction<CacheType>
): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let member = interaction.member as GuildMember; //need this for later

Expand Down
4 changes: 2 additions & 2 deletions src/slashcommands/PlayNext.ts → docs/Archive/PlayNext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
CommandInteraction,
CacheType,
MessageEmbed,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
Expand All @@ -23,7 +23,7 @@ export class PlayNext implements SlashCommand {
interaction: CommandInteraction<CacheType>
): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let member = interaction.member as GuildMember;

Expand Down
4 changes: 2 additions & 2 deletions src/slashcommands/Queue.ts → docs/Archive/Queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
CommandInteraction,
CacheType,
Message,
MessageEmbed,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
Expand All @@ -17,7 +17,7 @@ export class Queue implements SlashCommand {
requiredPermissions: bigint[] = [];
run(bot: Bot, interaction: CommandInteraction<CacheType>): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing || queue.tracks.length == 0)
Expand Down
45 changes: 45 additions & 0 deletions docs/Archive/Resume.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
import { colorCheck } from '../resources/embedColorCheck';
import { SlashCommand } from './SlashCommand';

export class Resume implements SlashCommand {
name: string = 'resume';
description = 'Resume the music player';
options = [];
requiredPermissions: bigint[] = [];
async run(
bot: Bot,
interaction: CommandInteraction<CacheType>
): Promise<void> {
try {
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
embed.setDescription('There is no music playing!');
return interaction.reply({ embeds: [embed], ephemeral: true });
}
queue.setPaused(false);
embed.setDescription(`Track was resumed by ${interaction.user}`);
return interaction.reply({ embeds: [embed] });
} catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
interaction.reply({
content: 'Error: contact a developer to investigate',
ephemeral: true,
});
return;
}
}
guildRequired?: boolean | undefined = true;
managerRequired?: boolean | undefined;
blockSilenced?: boolean | undefined = true;
musicCommand?: boolean | undefined = true;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Message, Permissions, MessageEmbed, TextChannel } from 'discord.js';
import { Message, EmbedBuilder, TextChannel, PermissionsBitField } from 'discord.js';
import { Bot } from '../Bot';
import { MessageCommand } from './MessageCommand';
import config from '../../config.json';
import { updateChannels } from '../slashcommands/Update';

export class SendUpdate implements MessageCommand {
name: string = 'sendupdate';
requiredPermissions: bigint[] = [Permissions.FLAGS.SEND_MESSAGES];
requiredPermissions: bigint[] = [PermissionsBitField.Flags.SendMessages];
async run(
bot: Bot,
message: Message<boolean>,
Expand All @@ -18,7 +18,7 @@ export class SendUpdate implements MessageCommand {
return; //we dont need to respond because as far as anyone cares this command does not matter
}
let content = message.content.slice(12); //cuts out "$sendupdate "
let embed = new MessageEmbed()
let embed = new EmbedBuilder()
.setColor('#FFFFFF')
.setTitle(
':mirror: **__Mirror Update!__** <:homies:863998146589360158>'
Expand Down
10 changes: 6 additions & 4 deletions src/slashcommands/Shuffle.ts → docs/Archive/Shuffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
MessageEmbed,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { Bot } from '../Bot';
Expand All @@ -19,16 +19,18 @@ export class Shuffle implements SlashCommand {
interaction: CommandInteraction<CacheType>
): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
embed.setDescription('There is no music playing!');
return interaction.reply({ embeds: [embed], ephemeral: true });
interaction.reply({ embeds: [embed], ephemeral: true });
return;
}
await queue.shuffle();
embed.setDescription(`Queue has been shuffled by ${interaction.user}`);
return interaction.reply({ embeds: [embed] });
interaction.reply({ embeds: [embed] });
return;
} catch (err) {
bot.logger.commandError(interaction.channel!.id, this.name, err);
interaction.reply({
Expand Down
8 changes: 4 additions & 4 deletions src/slashcommands/Skip.ts → docs/Archive/Skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
ApplicationCommandDataResolvable,
CommandInteraction,
CacheType,
MessageEmbed,
EmbedBuilder,
GuildMember,
} from 'discord.js';
import { ApplicationCommandOptionTypes } from 'discord.js/typings/enums';
import { ApplicationCommandOptionType } from 'discord.js/typings/enums';
import { Bot } from '../Bot';
import { SlashCommand } from './SlashCommand';
import { Option } from './Option';
Expand All @@ -19,7 +19,7 @@ export class Skip implements SlashCommand {
new Option(
'number',
'How many tracks you want to skip in the queue',
ApplicationCommandOptionTypes.INTEGER,
ApplicationCommandOptionType.INTEGER,
false
)
];
Expand All @@ -29,7 +29,7 @@ export class Skip implements SlashCommand {
interaction: CommandInteraction<CacheType>
): Promise<void> {
try {
const embed = new MessageEmbed().setColor(colorCheck(interaction.guild!.id,true));
const embed = new EmbedBuilder().setColor(colorCheck(interaction.guild!.id,true));

let queue = bot.player.getQueue(interaction.guild!.id);
if (!queue || !queue.playing) {
Expand Down
Loading