Added Debug to assist with yt latency troubleshooting
This commit is contained in:
parent
55500fc439
commit
988707ed9c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
.env
|
.env
|
||||||
config.json
|
.data/*
|
||||||
|
|||||||
40
bot.js
40
bot.js
@ -12,10 +12,13 @@ const client = new Client( { intents: [GatewayIntentBits.Guilds, GatewayIntentBi
|
|||||||
// Define Sigtrap Callback for clean shutdowns
|
// Define Sigtrap Callback for clean shutdowns
|
||||||
function signalExit(signal) {
|
function signalExit(signal) {
|
||||||
console.log(`\tCaught ${signal}`);
|
console.log(`\tCaught ${signal}`);
|
||||||
// Kills voice connections, and logs the client out
|
// Signal via discord that we are closing
|
||||||
client.destroy();
|
client.channels.fetch("860393205401255936")
|
||||||
// Exit with return code 0
|
.then(papi => papi.send('bye bye papi') )
|
||||||
process.exit(0);
|
// then disconnect
|
||||||
|
.then( client.destroy()
|
||||||
|
// and when that is done finally exit
|
||||||
|
.then( process.exit(0) ) );
|
||||||
}
|
}
|
||||||
// Subscribe to a few signal events
|
// Subscribe to a few signal events
|
||||||
process.on('SIGINT', signalExit); // For Ctrl-C when running in a TTY
|
process.on('SIGINT', signalExit); // For Ctrl-C when running in a TTY
|
||||||
@ -24,8 +27,13 @@ process.on('SIGTERM', signalExit); // for systemd's stoppping of services
|
|||||||
// Define Discord Callbacks
|
// Define Discord Callbacks
|
||||||
client.on( Events.ClientReady, c => {
|
client.on( Events.ClientReady, c => {
|
||||||
console.log(`Logged in Successfully as ${c.user.tag}`);
|
console.log(`Logged in Successfully as ${c.user.tag}`);
|
||||||
|
// Signal via discord that we are alive
|
||||||
|
client.channels.fetch("860393205401255936")
|
||||||
|
.then( papi => papi.send('hello papi') );
|
||||||
});
|
});
|
||||||
client.on( Events.MessageCreate, async message => {
|
client.on( Events.MessageCreate, async message => {
|
||||||
|
// Variables that may be useful
|
||||||
|
var d = new Date(); // Today's date and timestamp
|
||||||
// *** FIlter Section ***
|
// *** FIlter Section ***
|
||||||
// In the event of a DM...
|
// In the event of a DM...
|
||||||
if (message.guild == null) {
|
if (message.guild == null) {
|
||||||
@ -60,8 +68,6 @@ client.on( Events.MessageCreate, async message => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// *** Process Section ***
|
// *** Process Section ***
|
||||||
// Variables that may be useful
|
|
||||||
const d = new Date(); // Today's date and timestamp
|
|
||||||
// Check for the shutup message
|
// Check for the shutup message
|
||||||
if (message.content === "~") {
|
if (message.content === "~") {
|
||||||
console.log(`!stop issued by ${message.author.tag}`);
|
console.log(`!stop issued by ${message.author.tag}`);
|
||||||
@ -142,7 +148,9 @@ client.on( Events.MessageCreate, async message => {
|
|||||||
}
|
}
|
||||||
console.log(`yturl: ${yturl}`);
|
console.log(`yturl: ${yturl}`);
|
||||||
// Create a stream reference to the provided URL
|
// Create a stream reference to the provided URL
|
||||||
const stream = await play.stream(yturl, { seek: timestamp });
|
const stream = await play.stream(yturl, {
|
||||||
|
seek: timestamp
|
||||||
|
});
|
||||||
// Now that we have a stream reference we can join the channel and play
|
// Now that we have a stream reference we can join the channel and play
|
||||||
const connection = Voice.joinVoiceChannel({
|
const connection = Voice.joinVoiceChannel({
|
||||||
channelId: message.member.voice.channel.id,
|
channelId: message.member.voice.channel.id,
|
||||||
@ -162,9 +170,10 @@ client.on( Events.MessageCreate, async message => {
|
|||||||
}
|
}
|
||||||
if (message.content === "!help" ) {
|
if (message.content === "!help" ) {
|
||||||
console.log(`!help issued by ${message.author.tag} ${message.author.id}`);
|
console.log(`!help issued by ${message.author.tag} ${message.author.id}`);
|
||||||
var response = 'ZeSkypeBot v7.2.0 \'Table Salt\'\n';
|
var response = 'ZeSkypeBot v7.2.1 \'Table Salt\'\n';
|
||||||
response += 'Original by moosecrap#5953 for Skype, Remade by Weegee#6402 for Discord\n';
|
response += 'Original by @moosecrap for Skype, Remade by @fredstonemason for Discord\n';
|
||||||
response += 'Changelog:\n';
|
response += 'Changelog:\n';
|
||||||
|
response += 'v7.2.1 Added !echo to try and deduce why theres lag in commands\n';
|
||||||
response += 'v7.2.0 Attempts to fix seemingly random searches, now should support age-restricted videos\n';
|
response += 'v7.2.0 Attempts to fix seemingly random searches, now should support age-restricted videos\n';
|
||||||
response += 'v7.1.0 Added support for searching in !play\n'
|
response += 'v7.1.0 Added support for searching in !play\n'
|
||||||
response += 'v7.0.0 Update to Discord.js 14\n';
|
response += 'v7.0.0 Update to Discord.js 14\n';
|
||||||
@ -194,6 +203,19 @@ client.on( Events.MessageCreate, async message => {
|
|||||||
message.channel.send(response);
|
message.channel.send(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.content === "!echo" ) {
|
||||||
|
var response = 'Debug Timers:\n```';
|
||||||
|
response += `Discord Timestamp: ${message.createdAt.toISOString()}\n`;
|
||||||
|
response += `Local event start: ${d.toISOString()}\n`;
|
||||||
|
d = new Date();
|
||||||
|
response += `Local event now: ${d.toISOString()}\n`;
|
||||||
|
response += `Online Since: ${client.readyAt.toISOString()}\n`;
|
||||||
|
response += '```';
|
||||||
|
message.channel.send(response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
// Now our client is prepared, we can log in.
|
// Now our client is prepared, we can log in.
|
||||||
client.login(token);
|
client.login(token);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user