diff --git a/utils/Query.ts b/utils/Query.ts index 2e94b0956d..c07f47791d 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -42,6 +42,7 @@ import { markdownImage } from './Regex' export const imageRateLimit = new TLRU({ maxAgeMs: 60000 }) async function getBot(id: string, topLevel = true): Promise { + console.log('getBot, id:', id) const res = await knex('bots') .select([ 'id', @@ -72,7 +73,9 @@ async function getBot(id: string, topLevel = true): Promise { .orWhere({ vanity: id, partnered: true }) if (res[0]) { const discordBot = await get.discord.user.load(res[0].id) - if (!discordBot) return null + if (!discordBot) { + console.log(`discordBot for id ${res[0].id} is`, discordBot, 'returning null') + } const botMember = (await getMainGuild() ?.members?.fetch(res[0].id) .catch((e) => { @@ -193,6 +196,7 @@ async function getServerData(id: string): Promise { } async function getUser(id: string, topLevel = true): Promise { + console.log('getUser', id, topLevel) const res = await knex('users').select(['id', 'flags', 'github']).where({ id }) if (res[0]) { const ownedBots = await knex('bots') @@ -236,6 +240,7 @@ async function getUserGuilds(id: string): Promise> { } async function getBotList(type: ListType, page = 1, query?: string): Promise> { + console.log('getBotList', type, page, query) let res: { id: string }[] let count: string | number if (type === 'VOTE') { @@ -267,6 +272,7 @@ async function getBotList(type: ListType, page = 1, query?: string): Promise { + console.log('getDiscordUser', id) return await DiscordBot.users .fetch(id) .then((u) => u)