1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 09:03:50 -04:00

[untested] - start reorganizing the solver folder (renamed to artigen here), organize imports better since deno has support for it now

This commit is contained in:
Ean Milligan
2025-05-01 17:56:06 -04:00
parent b9c7fac984
commit 6e1c6e8db3
74 changed files with 645 additions and 667 deletions

View File

@@ -1,13 +1,16 @@
import { apiKeyDelete } from './deletes/apiKeyDelete.ts';
import { apiKey } from './gets/apiKey.ts';
import { apiRoll } from './gets/apiRoll.ts';
import { apiKeyAdmin } from './gets/apiKeyAdmin.ts';
import { apiChannel } from './gets/apiChannel.ts';
import { heatmapPng } from './gets/heatmapPng.ts';
import { apiChannelAdd } from './posts/apiChannelAdd.ts';
import { apiKeyManage } from './puts/apiKeyManage.ts';
import { apiChannelManageBan } from './puts/apiChannelManageBan.ts';
import { apiChannelManageActive } from './puts/apiChannelManageActive.ts';
import { apiKeyDelete } from 'endpoints/deletes/apiKeyDelete.ts';
import { apiChannel } from 'endpoints/gets/apiChannel.ts';
import { apiKey } from 'endpoints/gets/apiKey.ts';
import { apiKeyAdmin } from 'endpoints/gets/apiKeyAdmin.ts';
import { apiRoll } from 'endpoints/gets/apiRoll.ts';
import { heatmapPng } from 'endpoints/gets/heatmapPng.ts';
import { apiChannelAdd } from 'endpoints/posts/apiChannelAdd.ts';
import { apiChannelManageActive } from 'endpoints/puts/apiChannelManageActive.ts';
import { apiChannelManageBan } from 'endpoints/puts/apiChannelManageBan.ts';
import { apiKeyManage } from 'endpoints/puts/apiKeyManage.ts';
export default {
delete: {

View File

@@ -1,15 +1,15 @@
import config from '../../../config.ts';
import dbClient from '../../db/client.ts';
import {
// nanoid deps
nanoid,
// Discordeno deps
sendMessage,
} from '../../../deps.ts';
import { generateApiDeleteEmail } from '../../commandUtils.ts';
import utils from '../../utils.ts';
import stdResp from '../stdResponses.ts';
import { verifyQueryHasParams } from '../utils.ts';
import { sendMessage } from '@discordeno';
import { nanoid } from '@nanoid';
import config from '/config.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import { generateApiDeleteEmail } from 'src/commandUtils.ts';
import utils from 'src/utils.ts';
export const apiKeyDelete = async (query: Map<string, string>, apiUserid: bigint, apiUserEmail: string, apiUserDelCode: string): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'email'])) {

View File

@@ -1,7 +1,9 @@
import dbClient from '../../db/client.ts';
import stdResp from '../stdResponses.ts';
import utils from '../../utils.ts';
import { verifyQueryHasParams } from '../utils.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import utils from 'src/utils.ts';
export const apiChannel = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
if (verifyQueryHasParams(query, ['user'])) {

View File

@@ -1,15 +1,15 @@
import config from '../../../config.ts';
import dbClient from '../../db/client.ts';
import {
// nanoid deps
nanoid,
// Discordeno deps
sendMessage,
} from '../../../deps.ts';
import { generateApiKeyEmail } from '../../commandUtils.ts';
import utils from '../../utils.ts';
import stdResp from '../stdResponses.ts';
import { verifyQueryHasParams } from '../utils.ts';
import { sendMessage } from '@discordeno';
import { nanoid } from '@nanoid';
import config from '/config.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import { generateApiKeyEmail } from 'src/commandUtils.ts';
import utils from 'src/utils.ts';
export const apiKey = async (query: Map<string, string>): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'email'])) {

View File

@@ -1,12 +1,13 @@
import config from '../../../config.ts';
import dbClient from '../../db/client.ts';
import {
// nanoid deps
nanoid,
} from '../../../deps.ts';
import stdResp from '../stdResponses.ts';
import utils from '../../utils.ts';
import { verifyQueryHasParams } from '../utils.ts';
import { nanoid } from '@nanoid';
import config from '/config.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import utils from 'src/utils.ts';
export const apiKeyAdmin = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'a'])) {

View File

@@ -1,18 +1,18 @@
import config from '../../../config.ts';
import dbClient from '../../db/client.ts';
import { queries } from '../../db/common.ts';
import {
// Discordeno deps
cache,
// Log4Deno deps
log,
LT,
} from '../../../deps.ts';
import { RollModifiers } from '../../mod.d.ts';
import utils from '../../utils.ts';
import { queueRoll } from '../../solver/rollQueue.ts';
import stdResp from '../stdResponses.ts';
import { verifyQueryHasParams } from '../utils.ts';
import { cache } from '@discordeno';
import { log, LogTypes as LT } from '@Log4Deno';
import config from '/config.ts';
import { queueRoll } from 'artigen/managers/queueManager.ts';
import dbClient from 'db/client.ts';
import { queries } from 'db/common.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import { RollModifiers } from 'src/mod.d.ts';
import utils from 'src/utils.ts';
const apiWarning = `The following roll was conducted using my built in API. If someone in this channel did not request this roll, please report API abuse here: <${config.api.supportURL}>`;
@@ -115,7 +115,7 @@ export const apiRoll = async (query: Map<string, string>, apiUserid: bigint): Pr
} else {
// Alert API user that they messed up
return 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

@@ -1,8 +1,4 @@
import {
// httpd deps
STATUS_CODE,
STATUS_TEXT,
} from '../../../deps.ts';
import { STATUS_CODE, STATUS_TEXT } from '@std/http';
export const heatmapPng = (): Response => {
const file = Deno.readFileSync('./src/endpoints/gets/heatmap.png');

View File

@@ -1,7 +1,9 @@
import dbClient from '../../db/client.ts';
import stdResp from '../stdResponses.ts';
import utils from '../../utils.ts';
import { verifyQueryHasParams } from '../utils.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import utils from 'src/utils.ts';
export const apiChannelAdd = async (query: Map<string, string>, apiUserid: bigint): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'channel'])) {

View File

@@ -1,7 +1,9 @@
import dbClient from '../../db/client.ts';
import stdResp from '../stdResponses.ts';
import utils from '../../utils.ts';
import { verifyQueryHasParams } from '../utils.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import utils from 'src/utils.ts';
export const apiChannelManageActive = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'channel'])) {

View File

@@ -1,8 +1,11 @@
import config from '../../../config.ts';
import dbClient from '../../db/client.ts';
import stdResp from '../stdResponses.ts';
import utils from '../../utils.ts';
import { verifyQueryHasParams } from '../utils.ts';
import config from '/config.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import utils from 'src/utils.ts';
export const apiChannelManageBan = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'channel', 'a'])) {

View File

@@ -1,8 +1,11 @@
import config from '../../../config.ts';
import dbClient from '../../db/client.ts';
import stdResp from '../stdResponses.ts';
import utils from '../../utils.ts';
import { verifyQueryHasParams } from '../utils.ts';
import config from '/config.ts';
import dbClient from 'db/client.ts';
import stdResp from 'endpoints/stdResponses.ts';
import { verifyQueryHasParams } from 'endpoints/utils.ts';
import utils from 'src/utils.ts';
export const apiKeyManage = async (query: Map<string, string>, apiUserid: bigint, path: string): Promise<Response> => {
if (verifyQueryHasParams(query, ['user', 'a'])) {

View File

@@ -1,11 +1,7 @@
import {
STATUS_CODE,
STATUS_TEXT,
// httpd deps
StatusCode,
} from '../../deps.ts';
import { STATUS_CODE, STATUS_TEXT, StatusCode } from '@std/http';
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),