chore(deps): update discord-api-types and /voice (#7934)

This commit is contained in:
A. Román
2022-05-18 19:54:35 +02:00
committed by GitHub
parent dfe449c253
commit 993eb74475
24 changed files with 54 additions and 626 deletions

View File

@@ -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);

View File

@@ -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';

View File

@@ -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,
},

View File

@@ -66,7 +66,7 @@ async function record(
async function leave(
interaction: CommandInteraction,
recordable: Set<Snowflake>,
client: Client,
_client: Client,
connection?: VoiceConnection,
) {
if (connection) {