fix(recorder-example): bump dependencies (#8123)

This commit is contained in:
Anton Istomin
2022-07-07 00:25:10 +04:00
committed by GitHub
parent 0b979b04f2
commit 10ba0080cc
4 changed files with 18 additions and 15 deletions

View File

@@ -1,19 +1,21 @@
import Discord, { Events, Interaction } from 'discord.js';
import { getVoiceConnection } from '@discordjs/voice';
import { GatewayIntentBits } from 'discord-api-types/v9';
import Discord, { Interaction, Constants } from 'discord.js';
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 { token } = require('../auth.json') as { token: string };
const client = new Discord.Client({
intents: [GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds],
});
client.on(Events.ClientReady, () => console.log('Ready!'));
const { Events } = Constants;
client.on(Events.MessageCreate, async (message) => {
client.on(Events.CLIENT_READY, () => console.log('Ready!'));
client.on(Events.MESSAGE_CREATE, async (message) => {
if (!message.guild) return;
if (!client.application?.owner) await client.application?.fetch();
@@ -28,7 +30,7 @@ client.on(Events.MessageCreate, async (message) => {
*/
const recordable = new Set<string>();
client.on(Events.InteractionCreate, async (interaction: Interaction) => {
client.on(Events.INTERACTION_CREATE, async (interaction: Interaction) => {
if (!interaction.isCommand() || !interaction.guildId) return;
const handler = interactionHandlers.get(interaction.commandName);
@@ -44,6 +46,6 @@ client.on(Events.InteractionCreate, async (interaction: Interaction) => {
}
});
client.on(Events.Error, console.warn);
client.on(Events.ERROR, console.warn);
void client.login(token);

View File

@@ -1,8 +1,8 @@
import { createWriteStream } from 'node:fs';
import { pipeline } from 'node:stream';
import { EndBehaviorType, VoiceReceiver } from '@discordjs/voice';
import type { User } from 'discord.js';
import { createWriteStream } from 'node:fs';
import prism from 'prism-media';
import { pipeline } from 'node:stream';
import * as prism from 'prism-media';
function getDisplayName(userId: string, user?: User) {
return user ? `${user.username}_${user.discriminator}` : userId;
@@ -12,7 +12,7 @@ export function createListeningStream(receiver: VoiceReceiver, userId: string, u
const opusStream = receiver.subscribe(userId, {
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 100,
duration: 1000,
},
});