starboard: fix category overrides not working
This commit is contained in:
parent
7fb7787583
commit
e7d647f1e6
1 changed files with 10 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { starboardEvt } from "../types";
|
import { starboardEvt } from "../types";
|
||||||
import { Message } from "eris";
|
import { Message, TextChannel } from "eris";
|
||||||
import { UnknownUser, resolveMember, noop } from "src/utils";
|
import { UnknownUser, resolveMember, noop, resolveUser } from "src/utils";
|
||||||
import { saveMessageToStarboard } from "../util/saveMessageToStarboard";
|
import { saveMessageToStarboard } from "../util/saveMessageToStarboard";
|
||||||
|
|
||||||
export const StarboardReactionAddEvt = starboardEvt({
|
export const StarboardReactionAddEvt = starboardEvt({
|
||||||
|
@ -26,11 +26,15 @@ export const StarboardReactionAddEvt = starboardEvt({
|
||||||
// No self-votes!
|
// No self-votes!
|
||||||
if (msg.author.id === userId) return;
|
if (msg.author.id === userId) return;
|
||||||
|
|
||||||
const user = await resolveMember(pluginData.client, pluginData.guild, userId);
|
const member = await resolveMember(pluginData.client, pluginData.guild, userId);
|
||||||
if (user instanceof UnknownUser) return;
|
if (!member || member.bot) return;
|
||||||
if (user.bot) return;
|
|
||||||
|
const config = pluginData.config.getMatchingConfig({
|
||||||
|
member,
|
||||||
|
channelId: msg.channel.id,
|
||||||
|
categoryId: (msg.channel as TextChannel).parentID,
|
||||||
|
});
|
||||||
|
|
||||||
const config = pluginData.config.getMatchingConfig({ member: user, channelId: msg.channel.id });
|
|
||||||
const applicableStarboards = Object.values(config.boards)
|
const applicableStarboards = Object.values(config.boards)
|
||||||
.filter(board => board.enabled)
|
.filter(board => board.enabled)
|
||||||
// Can't star messages in the starboard channel itself
|
// Can't star messages in the starboard channel itself
|
||||||
|
|
Loading…
Add table
Reference in a new issue