mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 21:43:33 +01:00
fix(recorder-example): bump dependencies (#8123)
This commit is contained in:
@@ -14,15 +14,15 @@
|
|||||||
"author": "Amish Shah <contact@shah.gg>",
|
"author": "Amish Shah <contact@shah.gg>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/opus": "^0.5.3",
|
"@discordjs/opus": "^0.8.0",
|
||||||
"discord-api-types": "^0.30.0",
|
"discord-api-types": "^0.33.3",
|
||||||
"discord.js": "^13.7.0",
|
"discord.js": "^13.8.0",
|
||||||
"libsodium-wrappers": "^0.7.9",
|
"libsodium-wrappers": "^0.7.9",
|
||||||
"node-crc": "^1.3.2",
|
"node-crc": "^1.3.2",
|
||||||
"prism-media": "^2.0.0-alpha.0"
|
"prism-media": "^2.0.0-alpha.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tsconfig-paths": "^3.10.1",
|
"tsconfig-paths": "^3.10.1",
|
||||||
"typescript": "~4.3.5"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
import Discord, { Events, Interaction } from 'discord.js';
|
|
||||||
import { getVoiceConnection } from '@discordjs/voice';
|
import { getVoiceConnection } from '@discordjs/voice';
|
||||||
|
import { GatewayIntentBits } from 'discord-api-types/v9';
|
||||||
|
import Discord, { Interaction, Constants } from 'discord.js';
|
||||||
import { deploy } from './deploy';
|
import { deploy } from './deploy';
|
||||||
import { interactionHandlers } from './interactions';
|
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
|
// 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({
|
const client = new Discord.Client({
|
||||||
intents: [GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds],
|
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 (!message.guild) return;
|
||||||
if (!client.application?.owner) await client.application?.fetch();
|
if (!client.application?.owner) await client.application?.fetch();
|
||||||
|
|
||||||
@@ -28,7 +30,7 @@ client.on(Events.MessageCreate, async (message) => {
|
|||||||
*/
|
*/
|
||||||
const recordable = new Set<string>();
|
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;
|
if (!interaction.isCommand() || !interaction.guildId) return;
|
||||||
|
|
||||||
const handler = interactionHandlers.get(interaction.commandName);
|
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);
|
void client.login(token);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
import { createWriteStream } from 'node:fs';
|
||||||
|
import { pipeline } from 'node:stream';
|
||||||
import { EndBehaviorType, VoiceReceiver } from '@discordjs/voice';
|
import { EndBehaviorType, VoiceReceiver } from '@discordjs/voice';
|
||||||
import type { User } from 'discord.js';
|
import type { User } from 'discord.js';
|
||||||
import { createWriteStream } from 'node:fs';
|
import * as prism from 'prism-media';
|
||||||
import prism from 'prism-media';
|
|
||||||
import { pipeline } from 'node:stream';
|
|
||||||
|
|
||||||
function getDisplayName(userId: string, user?: User) {
|
function getDisplayName(userId: string, user?: User) {
|
||||||
return user ? `${user.username}_${user.discriminator}` : userId;
|
return user ? `${user.username}_${user.discriminator}` : userId;
|
||||||
@@ -12,7 +12,7 @@ export function createListeningStream(receiver: VoiceReceiver, userId: string, u
|
|||||||
const opusStream = receiver.subscribe(userId, {
|
const opusStream = receiver.subscribe(userId, {
|
||||||
end: {
|
end: {
|
||||||
behavior: EndBehaviorType.AfterSilence,
|
behavior: EndBehaviorType.AfterSilence,
|
||||||
duration: 100,
|
duration: 1000,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
|
"skipLibCheck": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@discordjs/voice": ["../../"],
|
"@discordjs/voice": ["../../"],
|
||||||
"libsodium-wrappers": ["./node_modules/libsodium-wrappers"]
|
"libsodium-wrappers": ["./node_modules/libsodium-wrappers"]
|
||||||
|
|||||||
Reference in New Issue
Block a user