Compare commits

...
7 Commits
Author SHA1 Message Date
Nyo 57d420a9f4 Update supportbot.yml 2026-05-12 16:31:37 +02:00
Nyo f8cc08ba3e Bump version from 26.0.0-prerelease-1 to 26.1.1 2026-05-12 16:31:23 +02:00
Nyo 60d5c4cb1f Change event name from 'ready' to 'clientReady' 2026-05-12 16:30:29 +02:00
Nyo 0288e2f4de Normalize channel, role, and category name comparisons 2026-05-12 16:30:12 +02:00
Nyo 33d5a79759 Refactor image handling in buildModernComponents
Refactored the buildModernComponents function to use MediaGalleryBuilder for image handling instead of TextDisplayBuilder. Cleaned up code formatting and removed unnecessary whitespace.
2026-05-12 16:29:54 +02:00
1tzEmerald 30b89a3cf9 Update supportbot.yml 2026-04-25 22:31:11 +01:00
1tzEmerald 427dc2d040 Merge pull request #209 from Emerald-Services/Dev-(26.1)
26.1
2026-04-25 21:57:00 +01:00
5 changed files with 22 additions and 27 deletions

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@
# #
# SupportBot Configuration (supportbot.yml) # SupportBot Configuration (supportbot.yml)
SupportBot_Version: "v26.1 DEV-2" SupportBot_Version: "v26.1.1"
# ------------------------- # -------------------------
# General # General
+13 -10
View File
@@ -8,7 +8,7 @@ const {
TextDisplayBuilder, TextDisplayBuilder,
SectionBuilder, SectionBuilder,
ThumbnailBuilder, ThumbnailBuilder,
AttachmentBuilder MediaGalleryBuilder
} = require("discord.js"); } = require("discord.js");
const fs = require("fs"); const fs = require("fs");
const yaml = require("js-yaml"); const yaml = require("js-yaml");
@@ -35,12 +35,12 @@ function getWelcomeThumbnail(client, member, iconCfg) {
} }
function buildModernComponents(client, member) { function buildModernComponents(client, member) {
const container = new ContainerBuilder() const container = new ContainerBuilder();
if (msgconfig.Welcome.Modern.Colour) { if (msgconfig.Welcome.Modern.Colour) {
container .setAccentColor(parseInt(msgconfig.Welcome.Modern.Colour.replace("#", ""), 16)); container.setAccentColor(parseInt(msgconfig.Welcome.Modern.Colour.replace("#", ""), 16));
} }
const section = new SectionBuilder().addTextDisplayComponents( const section = new SectionBuilder().addTextDisplayComponents(
new TextDisplayBuilder().setContent( new TextDisplayBuilder().setContent(
msgconfig.Welcome.Modern.Title.replace(/%joined_user%/g, member.user) msgconfig.Welcome.Modern.Title.replace(/%joined_user%/g, member.user)
@@ -60,11 +60,16 @@ function buildModernComponents(client, member) {
container.addSectionComponents(section); container.addSectionComponents(section);
// FIXED: Using MediaGalleryBuilder instead of TextDisplayBuilder for images
if (msgconfig.Welcome.Modern.Image?.Enabled && msgconfig.Welcome.Modern.Image.URL) { if (msgconfig.Welcome.Modern.Image?.Enabled && msgconfig.Welcome.Modern.Image.URL) {
container.addTextDisplayComponents( container.addMediaGalleryComponents(
new TextDisplayBuilder().setContent( new MediaGalleryBuilder().addItems([
`![image](${msgconfig.Welcome.Modern.Image.URL})` {
) media: {
url: msgconfig.Welcome.Modern.Image.URL
}
}
])
); );
} }
@@ -81,7 +86,6 @@ function buildModernComponents(client, member) {
}); });
container.addActionRowComponents(row); container.addActionRowComponents(row);
} }
return [container]; return [container];
@@ -150,5 +154,4 @@ module.exports = new Event("guildMemberAdd", async (client, member) => {
} }
console.log("\u001b[32m", "[+]", "\u001b[33m", `${member.user.username} joined the server!`); console.log("\u001b[32m", "[+]", "\u001b[33m", `${member.user.username} joined the server!`);
}); });
+6 -3
View File
@@ -60,26 +60,29 @@ class Client extends Discord.Client {
async getChannel(channel, guild) { async getChannel(channel, guild) {
if (!channel) return null; if (!channel) return null;
const channelStr = String(channel).toLowerCase();
return guild.channels.cache.find( return guild.channels.cache.find(
(c) => (c) =>
(c.type === Discord.ChannelType.GuildText || c.type === Discord.ChannelType.GuildNews) && (c.type === Discord.ChannelType.GuildText || c.type === Discord.ChannelType.GuildNews) &&
(c.id === channel || (c.name && c.name.toLowerCase() === channel.toLowerCase())), (c.id === channel || (c.name && c.name.toLowerCase() === channelStr)),
); );
} }
async getRole(role, guild) { async getRole(role, guild) {
if (!role) return null; if (!role) return null;
const roleStr = String(role).toLowerCase();
return guild.roles.cache.find( return guild.roles.cache.find(
(r) => r.id === role || (r.name && r.name.toLowerCase() === role.toLowerCase()), (r) => r.id === role || (r.name && r.name.toLowerCase() === roleStr),
); );
} }
async getCategory(category, guild) { async getCategory(category, guild) {
if (!category) return null; if (!category) return null;
const catStr = String(category).toLowerCase();
return guild.channels.cache.find( return guild.channels.cache.find(
(c) => (c) =>
c.type === Discord.ChannelType.GuildCategory && c.type === Discord.ChannelType.GuildCategory &&
(c.id === category || (c.name && c.name.toLowerCase() === category.toLowerCase())), (c.id === category || (c.name && c.name.toLowerCase() === catStr)),
); );
} }
+1 -12
View File
@@ -27,7 +27,7 @@ const APIServer = require("./API/server.js");
client.start(supportbot.General.Token); client.start(supportbot.General.Token);
client.once('ready', () => { client.once('clientReady', () => {
const api = new APIServer(client); const api = new APIServer(client);
api.start(); api.start();
}); });
@@ -77,14 +77,3 @@ process.on("unhandledRejection", (reason) => {
process.on("uncaughtException", (err) => { process.on("uncaughtException", (err) => {
console.error("Uncaught Exception:", err); console.error("Uncaught Exception:", err);
}); });
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "supportbot", "name": "supportbot",
"version": "26.0.0-prerelease-1", "version": "26.1.1",
"description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.", "description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {