Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
hwangsihu committed Oct 18, 2024
1 parent ec3e555 commit 22b3886
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 52 deletions.
8 changes: 4 additions & 4 deletions src/events/client/VoiceStateUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class VoiceStateUpdate extends Event {

handale = {
async join(newState: VoiceState, client: Lavamusic) {
await new Promise((resolve) => setTimeout(resolve, 3000));
await new Promise(resolve => setTimeout(resolve, 3000));
const bot = newState.guild.voiceStates.cache.get(client.user!.id);
if (!bot) return;

Expand All @@ -58,7 +58,7 @@ export default class VoiceStateUpdate extends Event {
bot.suppress
) {
if (bot.channel && bot.member && bot.channel.permissionsFor(bot.member!).has('MuteMembers')) {
await bot.setSuppressed(false)
await bot.setSuppressed(false);
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ export default class VoiceStateUpdate extends Event {

async move(newState: VoiceState, client: Lavamusic) {
// delay for 3 seconds
await new Promise((resolve) => setTimeout(resolve, 3000));
await new Promise(resolve => setTimeout(resolve, 3000));
const bot = newState.guild.voiceStates.cache.get(client.user!.id);
if (!bot) return;

Expand All @@ -125,7 +125,7 @@ export default class VoiceStateUpdate extends Event {
bot.suppress
) {
if (bot.channel && bot.member && bot.channel.permissionsFor(bot.member!).has('MuteMembers')) {
await bot.setSuppressed(false)
await bot.setSuppressed(false);
}
}
},
Expand Down
48 changes: 24 additions & 24 deletions src/events/player/PlayerDestroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ import { Event, type Lavamusic } from '../../structures/index';
import { updateSetup } from '../../utils/SetupSystem';

export default class PlayerDestroy extends Event {
constructor(client: Lavamusic, file: string) {
super(client, file, {
name: 'playerDestroy',
});
}
constructor(client: Lavamusic, file: string) {
super(client, file, {
name: 'playerDestroy',
});
}

public async run(player: Player, _reason: string): Promise<void> {
const guild = this.client.guilds.cache.get(player.guildId);
if (!guild) return;
const locale = await this.client.db.getLanguage(player.guildId);
await updateSetup(this.client, guild, locale);
public async run(player: Player, _reason: string): Promise<void> {
const guild = this.client.guilds.cache.get(player.guildId);
if (!guild) return;
const locale = await this.client.db.getLanguage(player.guildId);
await updateSetup(this.client, guild, locale);

const messageId = player.get<string | undefined>('messageId');
if (!messageId) return;
const messageId = player.get<string | undefined>('messageId');
if (!messageId) return;

const channel = guild.channels.cache.get(player.textChannelId!) as TextChannel;
if (!channel) return;
const channel = guild.channels.cache.get(player.textChannelId!) as TextChannel;
if (!channel) return;

const message = await channel.messages.fetch(messageId).catch(() => {
null;
});
if (!message) return;
const message = await channel.messages.fetch(messageId).catch(() => {
null;
});
if (!message) return;

if (message.editable) {
await message.edit({ components: [] }).catch(() => {
null;
});
}
}
if (message.editable) {
await message.edit({ components: [] }).catch(() => {
null;
});
}
}
}

/**
Expand Down
48 changes: 24 additions & 24 deletions src/events/player/PlayerDisconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ import { Event, type Lavamusic } from '../../structures/index';
import { updateSetup } from '../../utils/SetupSystem';

export default class PlayerDisconnect extends Event {
constructor(client: Lavamusic, file: string) {
super(client, file, {
name: 'playerDisconnect',
});
}
constructor(client: Lavamusic, file: string) {
super(client, file, {
name: 'playerDisconnect',
});
}

public async run(player: Player, _voiceChannelId: string): Promise<void> {
const guild = this.client.guilds.cache.get(player.guildId);
if (!guild) return;
const locale = await this.client.db.getLanguage(player.guildId);
await updateSetup(this.client, guild, locale);
public async run(player: Player, _voiceChannelId: string): Promise<void> {
const guild = this.client.guilds.cache.get(player.guildId);
if (!guild) return;
const locale = await this.client.db.getLanguage(player.guildId);
await updateSetup(this.client, guild, locale);

const messageId = player.get<string | undefined>('messageId');
if (!messageId) return;
const messageId = player.get<string | undefined>('messageId');
if (!messageId) return;

const channel = guild.channels.cache.get(player.textChannelId!) as TextChannel;
if (!channel) return;
const channel = guild.channels.cache.get(player.textChannelId!) as TextChannel;
if (!channel) return;

const message = await channel.messages.fetch(messageId).catch(() => {
null;
});
if (!message) return;
const message = await channel.messages.fetch(messageId).catch(() => {
null;
});
if (!message) return;

if (message.editable) {
await message.edit({ components: [] }).catch(() => {
null;
});
}
}
if (message.editable) {
await message.edit({ components: [] }).catch(() => {
null;
});
}
}
}

/**
Expand Down

0 comments on commit 22b3886

Please sign in to comment.