fix: annotations for events

This commit is contained in:
Marius Begby committed 2023-08-27 02:46:50 +02:00
1 parent 39e818283d
commit b118ebdfb0
26 files changed
+231 -173

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = {
name: 'debug',
isDebug: true,
isPlayerEvent: false,
execute: async (message) => {
execute: async (message: string) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'generalDebug.js',
+13 -10
View File
@@ -1,31 +1,32 @@
import config from 'config';
import { EmbedOptions } from '../../types/configTypes';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions = config.get('botOptions');
const systemOptions = config.get('systemOptions');
import { EmbedBuilder } from 'discord.js';
const botOptions: BotOptions = config.get('botOptions');
const systemOptions: SystemOptions = config.get('systemOptions');
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { v4 as uuidv4 } from 'uuid';
import loggerModule from '../../services/logger';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
// Emitted when the player queue encounters error (general error with queue)
module.exports = {
name: 'error',
isDebug: false,
isPlayerEvent: true,
execute: async (queue, error) => {
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'generalError.js',
module: 'event',
name: 'playerGeneralError',
executionId: executionId,
shardId: queue.metadata.client.shard.ids[0],
guildId: queue.metadata.channel.guild.id
shardId: queue.metadata?.client.shard?.ids[0],
guildId: queue.metadata?.channel.guild.id
});
logger.error(error, 'player.events.on(\'error\'): Player queue encountered error event');
logger.error(error, "player.events.on('error'): Player queue encountered error event");
await queue.metadata.channel.send({
await queue.metadata?.channel.send({
embeds: [
new EmbedBuilder()
.setDescription(
@@ -37,7 +38,9 @@ module.exports = {
});
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
const channel = await queue.metadata.client.channels.cache.get(systemOptions.systemMessageChannelId);
const channel = (await queue.metadata?.client.channels.cache.get(
systemOptions.systemMessageChannelId
)) as BaseGuildTextChannel;
if (channel) {
await channel.send({
embeds: [
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = {
name: 'error',
isDebug: true,
isPlayerEvent: true,
execute: async (message) => {
execute: async (message: string) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'playerDebug.js',
+13 -10
View File
@@ -1,31 +1,32 @@
import config from 'config';
import { EmbedOptions } from '../../types/configTypes';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions = config.get('botOptions');
const systemOptions = config.get('systemOptions');
import { EmbedBuilder } from 'discord.js';
const botOptions: BotOptions = config.get('botOptions');
const systemOptions: SystemOptions = config.get('systemOptions');
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { v4 as uuidv4 } from 'uuid';
import loggerModule from '../../services/logger';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
// Emitted when the player encounters an error while streaming audio track
module.exports = {
name: 'error',
isDebug: false,
isPlayerEvent: true,
execute: async (queue, error) => {
execute: async (queue: ExtendedGuildQueuePlayerNode, error: Error) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'playerError.js',
module: 'event',
name: 'playerError',
executionId: executionId,
shardId: queue.metadata.client.shard.ids[0],
guildId: queue.metadata.channel.guild.id
shardId: queue.metadata?.client.shard?.ids[0],
guildId: queue.metadata?.channel.guild.id
});
logger.error(error, 'player.events.on(\'playerError\'): Player error while streaming track');
logger.error(error, "player.events.on('playerError'): Player error while streaming track");
await queue.metadata.channel.send({
await queue.metadata?.channel.send({
embeds: [
new EmbedBuilder()
.setDescription(
@@ -37,7 +38,9 @@ module.exports = {
});
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
const channel = await queue.metadata.client.channels.cache.get(systemOptions.systemMessageChannelId);
const channel = (await queue.metadata?.client.channels.cache.get(
systemOptions.systemMessageChannelId
)) as BaseGuildTextChannel;
if (channel) {
await channel.send({
embeds: [
+13 -9
View File
@@ -1,31 +1,33 @@
import config from 'config';
import { EmbedOptions } from '../../types/configTypes';
import { BotOptions, EmbedOptions, SystemOptions } from '../../types/configTypes';
const embedOptions: EmbedOptions = config.get('embedOptions');
const botOptions = config.get('botOptions');
const systemOptions = config.get('systemOptions');
import { EmbedBuilder } from 'discord.js';
const botOptions: BotOptions = config.get('botOptions');
const systemOptions: SystemOptions = config.get('systemOptions');
import { BaseGuildTextChannel, EmbedBuilder } from 'discord.js';
import { v4 as uuidv4 } from 'uuid';
import loggerModule from '../../services/logger';
import { Track } from 'discord-player';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
// Emitted when the audio player fails to load the stream for a track
module.exports = {
name: 'playerSkip',
isDebug: false,
isPlayerEvent: true,
execute: async (queue, track) => {
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'playerSkip.js',
module: 'event',
name: 'playerSkip',
executionId: executionId,
shardId: queue.metadata.client.shard.ids[0],
guildId: queue.metadata.channel.guild.id
shardId: queue.metadata?.client.shard?.ids[0],
guildId: queue.metadata?.channel.guild.id
});
logger.error(`player.events.on('playerSkip'): Failed to play '${track.url}'.`);
await queue.metadata.channel.send({
await queue.metadata?.channel.send({
embeds: [
new EmbedBuilder()
.setDescription(
@@ -37,7 +39,9 @@ module.exports = {
});
if (systemOptions.systemMessageChannelId && systemOptions.systemUserId) {
const channel = await queue.metadata.client.channels.cache.get(systemOptions.systemMessageChannelId);
const channel = (await queue.metadata?.client.channels.cache.get(
systemOptions.systemMessageChannelId
)) as BaseGuildTextChannel;
if (channel) {
await channel.send({
embeds: [
+5 -3
View File
@@ -1,19 +1,21 @@
import { v4 as uuidv4 } from 'uuid';
import loggerModule from '../../services/logger';
import { Track } from 'discord-player';
import { ExtendedGuildQueuePlayerNode } from '../../types/eventTypes';
module.exports = {
name: 'playerStart',
isDebug: false,
isPlayerEvent: true,
execute: async (queue, track) => {
execute: async (queue: ExtendedGuildQueuePlayerNode, track: Track) => {
const executionId = uuidv4();
const logger = loggerModule.child({
source: 'playerStart.js',
module: 'event',
name: 'playerStart',
executionId: executionId,
shardId: queue.metadata.client.shard.ids[0],
guildId: queue.metadata.channel.guild.id
shardId: queue.metadata?.client.shard?.ids[0],
guildId: queue.metadata?.channel.guild.id
});
logger.debug(`playerStart event: Started playing '${track.url}'.`);