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

@@ -2,9 +2,7 @@
'use strict';
const request = require('superagent');
const ytdl = require('ytdl-core');
const { token, song } = require('./auth.js');
const { token } = require('./auth.js');
const { Client } = require('../src');
const { ChannelType, GatewayIntentBits } = require('discord-api-types/v10');
@@ -32,7 +30,7 @@ client.on('guildCreate', guild =>
// Fetch all members in a newly available guild
client.on('guildUpdate', (oldGuild, newGuild) =>
!oldGuild.available && newGuild.available
? guild.members.fetch().catch(err => console.log(`Failed to fetch all members: ${err}\n${err.stack}`))
? newGuild.members.fetch().catch(err => console.log(`Failed to fetch all members: ${err}\n${err.stack}`))
: Promise.resolve(),
);
@@ -99,12 +97,10 @@ client.on('messageCreate', message => {
}
if (message.content.startsWith('botavatar')) {
request.get('url').end((err, res) => {
client.user
.setAvatar(res.body)
.catch(console.error)
.then(user => message.channel.send('Done!'));
});
fetch('url')
.then(result => result.arrayBuffer())
.then(buffer => client.user.setAvatar(buffer))
.then(() => message.channel.send('Done!'), console.error);
}
if (message.content.startsWith('gn')) {
@@ -200,34 +196,6 @@ client.on('messageCreate', msg => {
}
});
let disp, con;
client.on('messageCreate', msg => {
if (msg.content.startsWith('/play')) {
console.log('I am now going to play', msg.content);
const chan = msg.content.split(' ').slice(1).join(' ');
const s = ytdl(chan, { filter: 'audioonly' }, { passes: 3 });
s.on('error', e => console.log(`e w stream 1 ${e}`));
con.play(s);
}
if (msg.content.startsWith('/join')) {
const chan = msg.content.split(' ').slice(1).join(' ');
msg.channel.guild.channels.cache
.get(chan)
.join()
.then(conn => {
con = conn;
msg.channel.send('done');
const s = ytdl(song, { filter: 'audioonly' }, { passes: 3 });
s.on('error', e => console.log(`e w stream 2 ${e}`));
disp = conn.playStream(s);
conn.player.on('debug', console.log);
conn.player.on('error', err => console.log(123, err));
})
.catch(console.error);
}
});
client.on('messageReactionAdd', (reaction, user) => {
if (reaction.message.channelId !== '222086648706498562') return;
reaction.message.channel.send(`${user.username} added reaction ${reaction.emoji}, count is now ${reaction.count}`);