Misc typos/bugs fixed
This commit is contained in:
Ean Milligan (Bastion) 2021-06-03 01:49:13 -04:00
parent af92920ec9
commit c0d9abbe70
4 changed files with 16 additions and 11 deletions

View File

@ -1,6 +1,6 @@
export const config = { export const config = {
"name": "Group Up", // Name of the bot "name": "Group Up", // Name of the bot
"version": "0.2.1", // Version of the bot "version": "0.2.3", // Version of the bot
"token": "the_bot_token", // Discord API Token for this bot "token": "the_bot_token", // Discord API Token for this bot
"localtoken": "local_testing_token", // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token" "localtoken": "local_testing_token", // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
"prefix": "[[", // Prefix for all commands "prefix": "[[", // Prefix for all commands

4
mod.ts
View File

@ -361,7 +361,7 @@ startBot({
log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`); log(LT.ERROR, `Failed to call stored procedure INC_CNT: ${JSON.stringify(e)}`);
}); });
const subcmd = args[0] || "help"; const subcmd = args[0].toLowerCase() || "help";
const lfgUid = (args[1] || "").toUpperCase(); const lfgUid = (args[1] || "").toUpperCase();
// Learn how the LFG command works // Learn how the LFG command works
@ -687,7 +687,7 @@ startBot({
if (interact.type === DiscordInteractionTypes.MessageComponent) { if (interact.type === DiscordInteractionTypes.MessageComponent) {
if (interact.message && interact.data && (interact.data as ButtonData).customId && interact.member) { if (interact.message && interact.data && (interact.data as ButtonData).customId && interact.member) {
log(LT.INFO, `Handling Button ${(interact.data as ButtonData).customId}`); log(LT.INFO, `Handling Button ${(interact.data as ButtonData).customId}`);
console.log(LT.LOG, `Button Data | ${JSON.stringify(interact)}`); log(LT.LOG, `Button Data | ${JSON.stringify(interact)}`);
sendInteractionResponse(BigInt(interact.id), interact.token, { sendInteractionResponse(BigInt(interact.id), interact.token, {
type: 6 type: 6

View File

@ -116,7 +116,7 @@ const lfgNotifier = async (activeLFGPosts: Array<ActiveLFG>): Promise<void> => {
editMsg += `<@${userId}>, `; editMsg += `<@${userId}>, `;
await sendDirectMessage(userId, { await sendDirectMessage(userId, {
embed: { embed: {
title: `Hello ${name}! You event in ${guildName} starts in less than 10 minutes.`, title: `Hello ${name}! Your event in ${guildName} starts in less than 10 minutes.`,
fields: [ fields: [
lfg[0], lfg[0],
{ {

View File

@ -207,7 +207,7 @@ export const handleLFGStep = async (wipLFG: BuildingLFG, input: string): Promise
} }
case "set_player_cnt": { case "set_player_cnt": {
if (parseInt(input)) { if (parseInt(input)) {
currentLFG[4].name = `Members Joined: ${currentLFG[4].value === "None" ? 0 : currentLFG[4].value.split("\n").length}/${parseInt(input)}`; currentLFG[4].name = `Members Joined: ${currentLFG[4].value === "None" ? 0 : currentLFG[4].value.split("\n").length}/${Math.abs(parseInt(input)) || 1}`;
nextQuestion = wipLFG.editing ? lfgStepQuestions.set_done : lfgStepQuestions.set_time; nextQuestion = wipLFG.editing ? lfgStepQuestions.set_done : lfgStepQuestions.set_time;
@ -215,7 +215,7 @@ export const handleLFGStep = async (wipLFG: BuildingLFG, input: string): Promise
} else { } else {
editFlag = false; editFlag = false;
nextQuestion = `Input max members "${input}" is invalid, please make sure you are only entering a number.\n\nPlease enter the max number of members for this activity:` nextQuestion = `Input max members "${input}" is invalid, please make sure you are only entering a number.\n\n${lfgStepQuestions.set_player_cnt}`
} }
break; break;
} }
@ -247,7 +247,7 @@ export const handleLFGStep = async (wipLFG: BuildingLFG, input: string): Promise
lfgPeriod = "pm"; lfgPeriod = "pm";
} else { } else {
lfgTime = c.startsWith("00") ? `12${c.substr(2)}` : c; lfgTime = c.startsWith("00") ? `12${c.substr(2)}` : c;
lfgPeriod = "am" lfgPeriod = "am";
} }
const hourLen = lfgTime.length === 4 ? 2 : 1; const hourLen = lfgTime.length === 4 ? 2 : 1;
@ -255,6 +255,10 @@ export const handleLFGStep = async (wipLFG: BuildingLFG, input: string): Promise
} else { } else {
lfgTime = c; lfgTime = c;
} }
} else if (c.match(/^\d/)) {
const tzIdx = c.search(/[a-zA-Z]/);
lfgTime = c.substr(0, tzIdx);
lfgTZ = determineTZ(c.substr(tzIdx));
} else { } else {
lfgTZ = determineTZ(c); lfgTZ = determineTZ(c);
} }
@ -269,14 +273,15 @@ export const handleLFGStep = async (wipLFG: BuildingLFG, input: string): Promise
} }
if (!lfgPeriod) { if (!lfgPeriod) {
lfgPeriod = parseInt(lfgTime.split(":")[0]) >= 12 ? "pm" : "am"; lfgPeriod = today.getHours() >= 12 ? "pm" : "am";
} }
lfgPeriod = lfgPeriod.toUpperCase(); lfgPeriod = lfgPeriod.toUpperCase();
lfgTZ = lfgTZ.toUpperCase(); lfgTZ = lfgTZ.toUpperCase();
lfgDate = `${lfgDate.split("/")[0]}/${lfgDate.split("/")[1]}/${today.getFullYear()}`; lfgDate = `${lfgDate.split("/")[0]}/${lfgDate.split("/")[1]}/${today.getFullYear()}`;
console.log(`${lfgTime} ${lfgPeriod} ${lfgTZ} ${lfgDate}`); log(LT.LOG, `Date Time Debug | ${lfgTime} ${lfgPeriod} ${lfgTZ} ${lfgDate}`);
const lfgDateTime = new Date(`${lfgTime} ${lfgPeriod} ${lfgTZ} ${lfgDate}`); const lfgDateTime = new Date(`${lfgTime} ${lfgPeriod} ${lfgTZ} ${lfgDate}`);
lfgDate = `${lfgDate.split("/")[0]}/${lfgDate.split("/")[1]}`; lfgDate = `${lfgDate.split("/")[0]}/${lfgDate.split("/")[1]}`;
@ -286,11 +291,11 @@ export const handleLFGStep = async (wipLFG: BuildingLFG, input: string): Promise
currentLFG[1].value = lfgDateStr.substr(0, 1023); currentLFG[1].value = lfgDateStr.substr(0, 1023);
if (isNaN(lfgDateTime.getTime())) { if (isNaN(lfgDateTime.getTime())) {
nextQuestion = `Input time "${input}" is invalid, please make sure you have the timezone set correctly.\n\n${lfgStepQuestions.set_time}`; nextQuestion = `Input time "${input}" (parsed as "${lfgTime} ${lfgPeriod} ${lfgTZ} ${lfgDate}") is invalid, please make sure you have the timezone set correctly.\n\n${lfgStepQuestions.set_time}`;
editFlag = false; editFlag = false;
} else if (lfgDateTime.getTime() <= today.getTime()) { } else if (lfgDateTime.getTime() <= today.getTime()) {
nextQuestion = `Input time "${input}" is in the past, please make sure you are setting up the event to be in the future.\n\n${lfgStepQuestions.set_time}`; nextQuestion = `Input time "${input}" (parsed as "${lfgTime} ${lfgPeriod} ${lfgTZ} ${lfgDate}") is in the past, please make sure you are setting up the event to be in the future.\n\n${lfgStepQuestions.set_time}`;
editFlag = false; editFlag = false;
} else { } else {