From b785efe4903e0238411a4bb79274c9c1d21cae5a Mon Sep 17 00:00:00 2001 From: roflmaoqwerty Date: Sun, 12 Jan 2020 22:19:10 +1100 Subject: [PATCH] success emoji now loaded from config --- backend/src/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index a2af241c..7961fcc3 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -75,6 +75,7 @@ import { customArgumentTypes } from "./customArgumentTypes"; import { errorMessage, successMessage } from "./utils"; import { startUptimeCounter } from "./uptime"; import { AllowedGuilds } from "./data/AllowedGuilds"; +import { IGuildData } from "knub/dist/Knub"; logger.info("Connecting to database"); connect().then(async conn => { @@ -160,9 +161,10 @@ connect().then(async conn => { customArgumentTypes, - sendSuccessMessageFn(channel: TextChannel, body) { - let config: IGuildConfig = this.getConfig(channel.guild.id); - channel.createMessage(successMessage(config., body)); + sendSuccessMessageFn(channel, body) { + const guildId = channel instanceof TextChannel ? channel.guild.id : null; + const emoji = (guildId ? bot.getGuildData(guildId).config.success_emoji : null) ?? 'default emoji here'; + channel.createMessage(successMessage(body, emoji)); }, sendErrorMessageFn(channel, body) {