mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
chore(deps): update discord-api-types and /voice (#7934)
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
import Discord, { Interaction } from 'discord.js';
|
||||
import Discord, { Events, Interaction } from 'discord.js';
|
||||
import { getVoiceConnection } from '@discordjs/voice';
|
||||
import { deploy } from './deploy';
|
||||
import { interactionHandlers } from './interactions';
|
||||
import { GatewayIntentBits } from 'discord-api-types/v9';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
||||
const { token } = require('../auth.json');
|
||||
|
||||
const client = new Discord.Client({ intents: ['GUILD_VOICE_STATES', 'GUILD_MESSAGES', 'GUILDS'] });
|
||||
const client = new Discord.Client({
|
||||
intents: [GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds],
|
||||
});
|
||||
|
||||
client.on('ready', () => console.log('Ready!'));
|
||||
client.on(Events.ClientReady, () => console.log('Ready!'));
|
||||
|
||||
client.on('messageCreate', async (message) => {
|
||||
client.on(Events.MessageCreate, async (message) => {
|
||||
if (!message.guild) return;
|
||||
if (!client.application?.owner) await client.application?.fetch();
|
||||
|
||||
@@ -25,7 +28,7 @@ client.on('messageCreate', async (message) => {
|
||||
*/
|
||||
const recordable = new Set<string>();
|
||||
|
||||
client.on('interactionCreate', async (interaction: Interaction) => {
|
||||
client.on(Events.InteractionCreate, async (interaction: Interaction) => {
|
||||
if (!interaction.isCommand() || !interaction.guildId) return;
|
||||
|
||||
const handler = interactionHandlers.get(interaction.commandName);
|
||||
@@ -41,6 +44,6 @@ client.on('interactionCreate', async (interaction: Interaction) => {
|
||||
}
|
||||
});
|
||||
|
||||
client.on('error', console.warn);
|
||||
client.on(Events.Error, console.warn);
|
||||
|
||||
void client.login(token);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EndBehaviorType, VoiceReceiver } from '@discordjs/voice';
|
||||
import { User } from 'discord.js';
|
||||
import type { User } from 'discord.js';
|
||||
import { createWriteStream } from 'node:fs';
|
||||
import prism from 'prism-media';
|
||||
import { pipeline } from 'node:stream';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Guild } from 'discord.js';
|
||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
||||
import type { Guild } from 'discord.js';
|
||||
|
||||
export const deploy = async (guild: Guild) => {
|
||||
await guild.commands.set([
|
||||
@@ -12,7 +13,7 @@ export const deploy = async (guild: Guild) => {
|
||||
options: [
|
||||
{
|
||||
name: 'speaker',
|
||||
type: 'USER' as const,
|
||||
type: ApplicationCommandOptionType.User,
|
||||
description: 'The user to record',
|
||||
required: true,
|
||||
},
|
||||
|
||||
@@ -66,7 +66,7 @@ async function record(
|
||||
async function leave(
|
||||
interaction: CommandInteraction,
|
||||
recordable: Set<Snowflake>,
|
||||
client: Client,
|
||||
_client: Client,
|
||||
connection?: VoiceConnection,
|
||||
) {
|
||||
if (connection) {
|
||||
|
||||
Reference in New Issue
Block a user