VoiceStateUpdate event
This commit is contained in:
1 parent
cdeea13fac
commit
edb0cf017a
8 files changed
+46
-12
No files matched your search
@@ -69,6 +69,9 @@
|
|||||||
<TypeScriptCompile Include="src\events\ready.ts">
|
<TypeScriptCompile Include="src\events\ready.ts">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</TypeScriptCompile>
|
</TypeScriptCompile>
|
||||||
|
<TypeScriptCompile Include="src\events\voiceStateUpdate.ts">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</TypeScriptCompile>
|
||||||
<TypeScriptCompile Include="src\types\Client.ts" />
|
<TypeScriptCompile Include="src\types\Client.ts" />
|
||||||
<TypeScriptCompile Include="src\types\Types.ts" />
|
<TypeScriptCompile Include="src\types\Types.ts" />
|
||||||
<TypeScriptCompile Include="src\types\Misc.ts" />
|
<TypeScriptCompile Include="src\types\Misc.ts" />
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { MyClient } from "../../types/Client";
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export async function run(client: MyClient, ctx: CommandInteraction) {
|
export async function run(client: MyClient, ctx: CommandInteraction) {
|
||||||
await ctx.deferReply();
|
await ctx.deferReply();
|
||||||
if (ctx.guild === null)
|
if (ctx.guild === null)
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { design } from "../../config";
|
import { design } from "../../config";
|
||||||
|
|
||||||
import { ColorResolvable, CommandInteraction, GuildMember, MessageEmbed, TextChannel } from "discord.js";
|
import {
|
||||||
|
ColorResolvable, CommandInteraction, GuildMember,
|
||||||
|
MessageEmbed, TextChannel
|
||||||
|
} from "discord.js";
|
||||||
import { MyClient } from "../../types/Client";
|
import { MyClient } from "../../types/Client";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { design } from "../../config";
|
import { design } from "../../config";
|
||||||
|
|
||||||
import { ButtonInteraction, ColorResolvable, CommandInteraction, Message, MessageActionRow, MessageButton, MessageEmbed } from "discord.js";
|
import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
|
||||||
import { MyClient } from "../../types/Client";
|
import { MyClient } from "../../types/Client";
|
||||||
import { generateQueue } from "../../types/Misc";
|
|
||||||
import { EmojiIdentifierResolvable } from "discord.js";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -22,8 +20,6 @@ export async function run(client: MyClient, ctx: CommandInteraction) {
|
|||||||
|
|
||||||
await ctx.reply({ embeds: [embed] });
|
await ctx.reply({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import { design } from "../../config";
|
import { design } from "../../config";
|
||||||
|
|
||||||
import { ButtonInteraction, CollectorFilter, ColorResolvable, CommandInteraction, Message, MessageActionRow, MessageButton, MessageComponentInteraction, MessageEmbed } from "discord.js";
|
import {
|
||||||
|
ButtonInteraction, CollectorFilter, ColorResolvable,
|
||||||
|
CommandInteraction, Message, MessageActionRow,
|
||||||
|
MessageButton, MessageComponentInteraction, MessageEmbed
|
||||||
|
} from "discord.js";
|
||||||
|
|
||||||
import { MyClient } from "../../types/Client";
|
import { MyClient } from "../../types/Client";
|
||||||
import { generateQueue } from "../../types/Misc";
|
import { generateQueue } from "../../types/Misc";
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ export async function run(client: MyClient, ctx: CommandInteraction) {
|
|||||||
|
|
||||||
await ctx.reply({ embeds: [embed] });
|
await ctx.reply({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { ColorResolvable, MessageEmbed, VoiceState } from "discord.js";
|
||||||
|
import { design } from "../config";
|
||||||
|
import { MyClient } from "../types/Client";
|
||||||
|
import { sleep } from "../types/Misc";
|
||||||
|
|
||||||
|
export async function run(args: VoiceState[], client: MyClient): Promise<void> {
|
||||||
|
const [oldState, newState] = args;
|
||||||
|
|
||||||
|
const player = client.players.getPlayer(newState.guild.id);
|
||||||
|
|
||||||
|
if (!player)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (newState.id === client.user?.id && newState.deaf === false) {
|
||||||
|
newState.setDeaf(true);
|
||||||
|
|
||||||
|
const embed = new MessageEmbed()
|
||||||
|
.setColor(design.color as ColorResolvable)
|
||||||
|
.setTitle("Please do not undeafen me.")
|
||||||
|
.setDescription("It's for your own privacy, trust me.")
|
||||||
|
await player.channel.send({ embeds: [embed] });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newState.channel?.members.size === 1 && newState.channel.members.first()) {
|
||||||
|
await sleep(30000);
|
||||||
|
if (newState.channel.members.first()?.id === client.user?.id)
|
||||||
|
player.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const name = "voiceStateUpdate";
|
||||||
@@ -39,7 +39,5 @@ export class MyClient extends DiscordClient {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user