1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 09:03:50 -04:00
This commit is contained in:
Ean Milligan
2025-04-26 13:23:37 -04:00
parent 76e007e2e4
commit c7c974c395
39 changed files with 1938 additions and 1943 deletions

View File

@@ -10,22 +10,22 @@ import { apiChannelManageBan } from './puts/apiChannelManageBan.ts';
import { apiChannelManageActive } from './puts/apiChannelManageActive.ts';
export default {
delete: {
apiKeyDelete,
},
get: {
apiKey,
apiRoll,
apiKeyAdmin,
apiChannel,
heatmapPng,
},
post: {
apiChannelAdd,
},
put: {
apiKeyManage,
apiChannelManageBan,
apiChannelManageActive,
},
delete: {
apiKeyDelete,
},
get: {
apiKey,
apiRoll,
apiKeyAdmin,
apiChannel,
heatmapPng,
},
post: {
apiChannelAdd,
},
put: {
apiKeyManage,
apiChannelManageBan,
apiChannelManageActive,
},
};

View File

@@ -15,7 +15,7 @@ export const apiKeyDelete = async (
query: Map<string, string>,
apiUserid: BigInt,
apiUserEmail: string,
apiUserDelCode: string
apiUserDelCode: string,
) => {
if (query.has('user') && (query.get('user') || '').length > 0 && query.has('email') && (query.get('email') || '').length > 0) {
if (apiUserid === BigInt(query.get('user') || '0') && apiUserEmail === query.get('email')) {

View File

@@ -103,13 +103,15 @@ export const apiRoll = async (requestEvent: Deno.RequestEvent, query: Map<string
};
// Parse the roll and get the return text
await queueRoll(<QueuedRoll>{
apiRoll: true,
api: { requestEvent, channelId: BigInt(query.get('channel') || '0'), userId: BigInt(query.get('user') || '') },
rollCmd,
modifiers,
originalCommand,
});
await queueRoll(
<QueuedRoll> {
apiRoll: true,
api: { requestEvent, channelId: BigInt(query.get('channel') || '0'), userId: BigInt(query.get('user') || '') },
rollCmd,
modifiers,
originalCommand,
},
);
} catch (err) {
// Handle any errors we missed
log(LT.ERROR, `Unhandled Error: ${JSON.stringify(err)}`);
@@ -119,8 +121,8 @@ export const apiRoll = async (requestEvent: Deno.RequestEvent, query: Map<string
// Alert API user that they messed up
requestEvent.respondWith(
stdResp.Forbidden(
`Verify you are a member of the guild you are sending this roll to. If you are, the ${config.name} may not have that registered, please send a message in the guild so ${config.name} can register this. This registration is temporary, so if you see this error again, just poke your server again.`
)
`Verify you are a member of the guild you are sending this roll to. If you are, the ${config.name} may not have that registered, please send a message in the guild so ${config.name} can register this. This registration is temporary, so if you see this error again, just poke your server again.`,
),
);
}
} else {

View File

@@ -14,6 +14,6 @@ export const heatmapPng = async (requestEvent: Deno.RequestEvent) => {
status: STATUS_CODE.OK,
statusText: STATUS_TEXT[STATUS_CODE.OK],
headers: imageHeaders,
})
}),
);
};

View File

@@ -1,12 +1,11 @@
import {
// httpd deps
StatusCode,
STATUS_CODE,
STATUS_TEXT,
// httpd deps
StatusCode,
} from '../../deps.ts';
const genericResponse = (customText: string, status: StatusCode) =>
new Response(customText || STATUS_TEXT[status], { status: status, statusText: STATUS_TEXT[status] });
const genericResponse = (customText: string, status: StatusCode) => new Response(customText || STATUS_TEXT[status], { status: status, statusText: STATUS_TEXT[status] });
export default {
BadRequest: (customText: string) => genericResponse(customText, STATUS_CODE.BadRequest),