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

Function deleteApplication

src/utils/database.js:1060–1083  ·  view source on GitHub ↗
(client, guildId, applicationId, userIdHint = null)

Source from the content-addressed store, hash-verified

1058}
1059
1060export async function deleteApplication(client, guildId, applicationId, userIdHint = null) {
1061 const key = getApplicationKey(guildId, applicationId);
1062
1063 try {
1064 const existing = unwrapReplitData(await client.db.get(key, null));
1065 const userId = userIdHint || existing?.userId || null;
1066
1067 await client.db.delete(key);
1068
1069 if (userId) {
1070 const userKey = getUserApplicationsKey(guildId, userId);
1071 const userApplications = await client.db.get(userKey, []);
1072 const unwrapped = unwrapReplitData(userApplications);
1073 const ids = Array.isArray(unwrapped) ? unwrapped : [];
1074 const filtered = ids.filter(id => id !== applicationId);
1075 await client.db.set(userKey, filtered);
1076 }
1077
1078 return true;
1079 } catch (error) {
1080 logger.error(`Error deleting application ${applicationId} in guild ${guildId}:`, error);
1081 return false;
1082 }
1083}
1084
1085export async function cleanupExpiredApplications(client, guildId) {
1086 try {

Callers 4

handleListFunction · 0.90
handleDeleteApplicationFunction · 0.90
executeFunction · 0.90

Calls 6

getApplicationKeyFunction · 0.85
unwrapReplitDataFunction · 0.85
getUserApplicationsKeyFunction · 0.85
getMethod · 0.45
deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected