Skip to main content
Glama
embeds.ts1.28 kB
import { MessageEmbed } from "discord.js"; import { CHANNELS } from "./channels"; import { rulesMessage } from "./embeds/rules"; import { welcomeMessage } from "./embeds/welcome_message"; // import { changeoverMessage } from "./embeds/changeover"; export async function syncEmbeds() { await sendEmbed("welcome", welcomeMessage()); await sendEmbed("rules", rulesMessage()); // This announcement was used when we enabled the requirement to agree to the rules to join the Discord. // await sendEmbed("general", changeoverMessage()); // await sendEmbed("announcements", changeoverMessage()); } export async function sendEmbed( channelName: string, embedToSend: MessageEmbed ): Promise<boolean> { const channel = CHANNELS[channelName]; if (channel) { let embedSent = false; const messages = await channel.messages.fetch(); for (const msg of messages.values()) { for (const embed of msg.embeds.values()) { if (embed.title == embedToSend.title) { msg.edit({ embeds: [embedToSend] }); embedSent = true; } } } if (!embedSent) { channel.send({ embeds: [embedToSend] }); } } else { throw new Error(`cannot send message to missing channel: ${channelName} `); } return true; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server