fix logs
This commit is contained in:
@ -40,8 +40,8 @@ export function initDiscordBot() {
|
||||
* @param channelId the channel id to log to
|
||||
* @param message the message to log
|
||||
*/
|
||||
export function logToChannel(channelId: DiscordChannels, message: EmbedBuilder) {
|
||||
const channel = DiscordBot.channels.cache.find(c => c.id === channelId);
|
||||
export async function logToChannel(channelId: DiscordChannels, message: EmbedBuilder) {
|
||||
const channel = await DiscordBot.channels.fetch(channelId);
|
||||
if (channel == undefined) {
|
||||
throw new Error(`Channel "${channelId}" not found`);
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ connectScoreSaberWebSocket({
|
||||
await PlayerService.trackScore(playerScore);
|
||||
await ScoreService.notifyNumberOne(playerScore);
|
||||
},
|
||||
onDisconnect: error => {
|
||||
logToChannel(
|
||||
onDisconnect: async error => {
|
||||
await logToChannel(
|
||||
DiscordChannels.backendLogs,
|
||||
new EmbedBuilder().setDescription(`ScoreSaber websocket disconnected: ${error}`)
|
||||
);
|
||||
|
@ -43,7 +43,7 @@ export class PlayerService {
|
||||
|
||||
// Only notify in production
|
||||
if (isProduction()) {
|
||||
logToChannel(
|
||||
await logToChannel(
|
||||
DiscordChannels.trackedPlayerLogs,
|
||||
new EmbedBuilder()
|
||||
.setTitle("New Player Tracked")
|
||||
|
@ -45,7 +45,7 @@ export class ScoreService {
|
||||
return;
|
||||
}
|
||||
|
||||
logToChannel(
|
||||
await logToChannel(
|
||||
DiscordChannels.numberOneFeed,
|
||||
new EmbedBuilder()
|
||||
.setTitle(`${player.name} set a #1 on ${leaderboard.songName} ${leaderboard.songSubName}`)
|
||||
|
Reference in New Issue
Block a user