MCPcopy
hub / github.com/codebymitch/TitanBot / getGuildConfig

Function getGuildConfig

src/utils/database.js:247–268  ·  view source on GitHub ↗
(client, guildId, context = {})

Source from the content-addressed store, hash-verified

245export const getGuildBirthdaysKey = (guildId) => `guild:${guildId}:birthdays`;
246
247export async function getGuildConfig(client, guildId, context = {}) {
248 try {
249 if (!client.db || typeof client.db.get !== "function") {
250 return {};
251 }
252
253 const configKey = getGuildConfigKey(guildId);
254 const rawConfig = await client.db.get(configKey, {});
255 const cleanedConfig = unwrapReplitData(rawConfig);
256
257 return normalizeGuildConfig(cleanedConfig, DEFAULT_GUILD_CONFIG);
258 } catch (error) {
259 logger.error(`Error fetching config for guild ${guildId}`, {
260 error,
261 traceId: context.traceId,
262 guildId,
263 userId: context.userId,
264 command: context.command
265 });
266 return {};
267 }
268}
269
270export async function setGuildConfig(client, guildId, config, context = {}) {
271 try {

Callers 15

logTicketEventFunction · 0.90
getTicketLoggingConfigFunction · 0.90
handleApplicationModalFunction · 0.90
buildDashboardEmbedFunction · 0.90
executeFunction · 0.90
showApplicationDashboardFunction · 0.90
executeFunction · 0.90
buy.jsFile · 0.90
daily.jsFile · 0.90
executeFunction · 0.90
executeFunction · 0.90

Calls 4

normalizeGuildConfigFunction · 0.90
getGuildConfigKeyFunction · 0.85
unwrapReplitDataFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected