Temp solution for duplicate channels

master
Miikka Virtanen 2017-01-01 05:52:48 +02:00
parent c7b7b784d9
commit 4e667bc689
1 changed files with 11 additions and 0 deletions

View File

@ -214,6 +214,17 @@ function getModmailChannel(user, allowCreate = true) {
if (channel) {
return Promise.resolve(channel);
} else {
// FIXME: Temp fix, return mock channel and assume it exists.. maybe
const channelId = modMailChannels[user.id];
return Promise.resolve({
id: channelId,
name: 'temp-mock-channel',
createMessage: function() {
return modMailGuild.createMessage(channelId, ...arguments);
},
mention: `<#${channelId}>`,
});
// If the cache value was invalid, remove it
delete modMailChannels[user.id];
console.log(`[NOTE] INVALID CACHE VALUE FOR ${user.id}`);