|
@@ -15,9 +15,9 @@ async function getRandomEmotes(allowedTypes: ReactionType[]) {
|
|
|
select reactionId
|
|
|
from ( select type, reactionId
|
|
|
from reaction_emote
|
|
|
- where type in (?)
|
|
|
+ where type in (${allowedTypes.map(s => "?").join(",")})
|
|
|
order by type, random() )
|
|
|
- group by type`, [ allowedTypes ]) as string[];
|
|
|
+ group by type`, allowedTypes) as string[];
|
|
|
}
|
|
|
|
|
|
export default {
|
|
@@ -117,7 +117,7 @@ export default {
|
|
|
|
|
|
let knownUsers = await usersRepo.find({
|
|
|
select: [ "mentionReactionType" ],
|
|
|
- where: [...msg.mentions.users.map(u => ({ userId: u.id }))]
|
|
|
+ where: [...msg.mentions.users.map(u => ({ userID: u.id }))]
|
|
|
});
|
|
|
|
|
|
if(knownUsers.length == 0)
|
|
@@ -153,10 +153,11 @@ export default {
|
|
|
where: [{userID: msg.id}]
|
|
|
});
|
|
|
|
|
|
- if(!knownUser || knownUser.mentionReactionType == ReactionType.NONE)
|
|
|
- return false;
|
|
|
-
|
|
|
- emoteType = knownUser.mentionReactionType;
|
|
|
+ if(knownUser){
|
|
|
+ if(knownUser.mentionReactionType == ReactionType.NONE)
|
|
|
+ return false;
|
|
|
+ emoteType = knownUser.mentionReactionType;
|
|
|
+ }
|
|
|
|
|
|
let emotes = await getRandomEmotes([ emoteType ]);
|
|
|
|