import { ChannelType, Colors, EmbedBuilder, Message, PermissionFlagsBits, } from "discord.js"; import { CustomClient, PrefixCommand } from "../../base/classes"; import { Category } from "../../base/enum"; import { SearchResult, UnresolvedSearchResult, } from "lavalink-client/dist/types"; export default class MusicPlay extends PrefixCommand { constructor(client: CustomClient) { super(client, { command: "play", description: "Putar musik bareng teman mu!", cooldown: 5, category: Category.Miscellaneous, }); } async execute(message: Message, args: string[]) { message = await message.reply({ embeds: [ new EmbedBuilder() .setDescription("🤔 Loading...") .setFooter({ text: "✨ © Dreasic" }) .setColor(Colors.Orange), ], }); if (!message.inGuild()) return message .edit({ embeds: [ new EmbedBuilder() .setDescription( "❌" ) .setFooter({ text: "✨ © Dreasic" }) .setColor(Colors.Red), ], }) .then((msg) => setTimeout(() => msg.delete(), 10000)); const memberVC = message.member.voice.channel; const clientVC = message.guild.members.me.voice.channel; if (!memberVC) return await message .edit({ embeds: [ new EmbedBuilder() .setDescription("❌ Kamu harus join voice channel dulu.") .setFooter({ text: "✨ © Dreasic" }) .setColor(Colors.Red), ], }) .then((msg) => setTimeout(() => msg.delete(), 10000)); if ( !memberVC .permissionsFor(this.client.user.id) .has(PermissionFlagsBits.Connect) ) return await message .edit({ embeds: [ new EmbedBuilder() .setDescription( "❌" ) .setFooter({ text: "✨ © Dreasic" }) .setColor(Colors.Red), ], }) .then((msg) => setTimeout(() => msg.delete(), 10000)); if ( !memberVC .permissionsFor(this.client.user.id) .has(PermissionFlagsBits.Speak) ) return await message .edit({ embeds: [ new EmbedBuilder() .setDescription( "❌" ) .setFooter({ text: "✨ © Dreasic" }) .setColor(Colors.Red), ], }) .then((msg) => setTimeout(() => msg.delete(), 10000)); // .... } }