Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BetterBotTags.plugin.js to fix the addon #83

Open
wants to merge 2 commits into
base: potato
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Plugins/BetterBotTags/BetterBotTags.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @description Some improvements for bot tags, like the addition of webhook tags.
* @author Qb
* @authorId 133659541198864384
* @version 2.0.1
* @version 2.0.2
* @invite gj7JFa6mF8
* @source https://github.com/QbDesu/BetterDiscordAddons/blob/potato/Plugins/BetterBotTags
* @updateUrl https://raw.githubusercontent.com/QbDesu/BetterDiscordAddons/potato/Plugins/BetterBotTags/BetterBotTags.plugin.js
Expand All @@ -21,14 +21,13 @@ module.exports = (() => {
const config = {
info: {
name: "BetterBotTags",
version: "2.0.1",
version: "2.0.2",
github_raw: "https://raw.githubusercontent.com/QbDesu/BetterDiscordAddons/potato/Plugins/BetterBotTags/BetterBotTags.plugin.js"
},
changelog: [
{
title: 'Bug Fixes', types: 'fixed', items: [
'Fixed missing padding in replies and compact display.',
'Fixed surplus space when icons are disabled.',
'Fixed the tags no longer showing up.',
],
},
],
Expand Down Expand Up @@ -89,7 +88,7 @@ module.exports = (() => {
};


const MessageHeader = getModuleAndKey(Filters.byStrings(".message",".compact", ".author", ".showPopout"));
const MessageHeader = getModuleAndKey(Filters.byStrings("message","compact", "author", "showPopout", "decoration"));
const BotTag = getModuleAndKey(Filters.combine(Filters.byProps("Types"), Filters.byStrings(".BOT")));

const BotTagTypes = {
Expand Down Expand Up @@ -162,7 +161,9 @@ module.exports = (() => {
})
);

const botTagClasses = getModule(Filters.byProps("botTag","botTagCozy"));
const botTagClassesTmp = getModule(Filters.byProps("botTag", "botTagCozy"));
const botTagClasses = botTagClassesTmp ?? getModule(Filters.byProps("botTag"));
if (botTagClasses && !botTagClasses.botTagCozy) botTagClasses.botTagCozy = getModule(Filters.byProps("botTagCozy"))?.botTagCozy;
const botTagVariantClasses = getModule(Filters.byProps("botTagRegular"));

const joinClassNames = (...classNames) => classNames.filter(Boolean).join(" ");
Expand Down Expand Up @@ -239,7 +240,7 @@ module.exports = (() => {
else if (this.isDefaultMessage(message)) type = this.isOfficial(message) ? BotTagTypes.OFFICIAL : BotTagTypes.SERVER;
else if (this.isWebhook(message)) type = BotTagTypes.WEBHOOK;
else if (user?.bot) type = BotTagTypes.BOT;
else if (channel.isForumPost() && channel.ownerId === user.id && !isRepliedMessage) type = BotTagTypes.ORIGINAL_POSTER;
else if (channel?.isForumPost() && channel.ownerId === user.id && !isRepliedMessage) type = BotTagTypes.ORIGINAL_POSTER;

if (type==null) return;
for (let key in decorations) {
Expand Down Expand Up @@ -270,6 +271,7 @@ module.exports = (() => {

onStart() {
if (!BotTag) return BdApi.showToast(`${config.info.name}: Failed to resolve BotTag Module`, { type: "error" });
if (!MessageHeader) return BdApi.showToast(`${config.info.name}: Failed to resolve MessageHeader Module`, { type: "error" });
this.patch();
}

Expand Down