Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
conch: Added conch to the config, formatted the file
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpt-Dingus committed Aug 5, 2023
1 parent 70b875d commit 3ee95a9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 47 deletions.
3 changes: 3 additions & 0 deletions config.default.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
},
"whois": {
"enabled": true
},
"conch": {
"enabled": true
}
}
}
95 changes: 48 additions & 47 deletions src/modules/conch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,67 @@
* This file contains the 'conch' module definition.
*/


const RESPONSES: string[] = [
"As I see it, yes.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again.",
"Don’t count on it.",
"It is certain.",
"It is decidedly so.",
"Most likely.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Outlook good.",
"Reply hazy, try again.",
"Signs point to yes.",
"Very doubtful.",
"Without a doubt.",
"Yes.",
"Yes – definitely.",
"You may rely on it.",
]

const THUMBNAIL_URL: string = "https://i.imgur.com/vdvGrsR.png"
'As I see it, yes.',
'Ask again later.',
'Better not tell you now.',
'Cannot predict now.',
'Concentrate and ask again.',
'Don’t count on it.',
'It is certain.',
'It is decidedly so.',
'Most likely.',
'My reply is no.',
'My sources say no.',
'Outlook not so good.',
'Outlook good.',
'Reply hazy, try again.',
'Signs point to yes.',
'Very doubtful.',
'Without a doubt.',
'Yes.',
'Yes – definitely.',
'You may rely on it.',
];

const THUMBNAIL_URL = 'https://i.imgur.com/vdvGrsR.png';

import { Colors, EmbedBuilder } from 'discord.js';
import * as util from '../core/util.js'
import {Colors, EmbedBuilder} from 'discord.js';
import * as util from '../core/util.js';

function getRandomReply(): string {

return RESPONSES[Math.floor(Math.random() * RESPONSES.length)]
return RESPONSES[Math.floor(Math.random() * RESPONSES.length)];
}

/** Formats a question for the embed, trims it if needed
* @param question The question to format
* @reutrns The formatted question string
*/
function formatQuestion(question: string): string {
question = question.substring(0, 255);
if (!question.endsWith("?")) {
question += "?";
}
return question;
question = question.substring(0, 255);
if (!question.endsWith('?')) {
question += '?';
}
return question;
}


/** The root conch command definition */
const conch = new util.RootModule('conch', 'Asks a question to the magic conch (8ball)', [],
[
const conch = new util.RootModule(
'conch',
'Asks a question to the magic conch (8ball)',
[],
[
{
type: util.ModuleOptionType.String,
name: 'question',
description: 'The question to ask',
required: true,
}
],
async (args, interaction) => {
const question: string = args.find(arg => arg.name === 'question')!.value!.toString();
type: util.ModuleOptionType.String,
name: 'question',
description: 'The question to ask',
required: true,
},
],
async (args, interaction) => {
const question: string = args
.find(arg => arg.name === 'question')!
.value!.toString();

const embed: EmbedBuilder = new EmbedBuilder();

Expand All @@ -72,7 +73,7 @@ async (args, interaction) => {
embed.setThumbnail(THUMBNAIL_URL);

await util.replyToInteraction(interaction, {embeds: [embed]});
}
);

})

export default conch;
export default conch;

0 comments on commit 3ee95a9

Please sign in to comment.