Skip to content

Commit

Permalink
Remove embed from help message and update language (#29)
Browse files Browse the repository at this point in the history
* update help message language, remove embed for link

* fix spec
  • Loading branch information
AlecM33 authored Mar 20, 2024
1 parent a43eb65 commit 5d20680
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions modules/interaction-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
} catch (e) {
console.error(e);
await interaction.reply({
content: responseMessages.GENERIC_ERROR,
content: responseMessages.GENERIC_INTERACTION_ERROR,
ephemeral: true
});
}
Expand All @@ -35,7 +35,7 @@ module.exports = {
} catch (e) {
console.error(e);
await interaction.reply({
content: responseMessages.GENERIC_ERROR,
content: responseMessages.GENERIC_INTERACTION_ERROR,
ephemeral: true
});
}
Expand Down Expand Up @@ -142,7 +142,7 @@ module.exports = {
const includeIdentifier = interaction.options.getBoolean('include_identifier');
const searchResults = await queries.fetchQuotesBySearchString(searchString, interaction.guildId).catch(async (e) => {
console.error(e);
await interaction.followUp({ content: responseMessages.GENERIC_ERROR });
await interaction.followUp({ content: responseMessages.GENERIC_INTERACTION_ERROR });
});

let reply = '';
Expand Down Expand Up @@ -170,7 +170,7 @@ module.exports = {
console.info(`DELETE command invoked by guild: ${interaction.guildId}`);
const result = await queries.deleteQuoteById(interaction.options.getInteger('identifier'), interaction.guildId).catch(async (e) => {
console.error(e);
await interaction.reply({ content: responseMessages.GENERIC_ERROR, ephemeral: true });
await interaction.reply({ content: responseMessages.GENERIC_INTERACTION_ERROR, ephemeral: true });
});

if (!interaction.replied) {
Expand Down
9 changes: 4 additions & 5 deletions modules/response-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
DELETE_SUCCESS: 'The quote was successfully removed.',
NOTHING_DELETED: 'There is no quote with that identifier, so nothing was deleted.',
DUPLICATE_QUOTE: 'An identical quote by this person has already been saved!',
GENERIC_ERROR: 'There was a problem saving your quote. Please try again later',
GENERIC_RETRIEVAL_ERROR: 'There was a problem retrieving the specified quotes. Please contact the developer.',
INCORRECT_AUTHOR_SYNTAX: "Invalid command. The author's name can only contain letters and spaces.",
QUOTE_COUNT_0: 'There are no quotes saved!',
Expand All @@ -20,11 +19,11 @@ module.exports = {
' info found with the `/help` commmand.',
HELP_MESSAGE: '\n\n**About:**\n\nThis is a bot for adding quotes and revisiting them later. To get the latest info on ' +
'changes to the bot, use the `/updates` command.\n\n' +
'Add a quote with `/add`. The author can be a mention of a user in the server (e.g. @Bob) or simply a name (Bob). The quotation can be ' +
'entered as it is - there is no need to wrap it in quotation marks. If the quote was said before today, you can optionally provide a "date" parameter (MM/DD/YYYY or MM-DD-YYYY)\n\n' +
'Add a quote with `/add`. The author can be a mention of a user in the server (e.g. @Bob) or simply a name (Bob). You ' +
'do not need to wrap the quote in quotation marks. If the quote was said before today, you can optionally provide a "date" parameter (MM/DD/YYYY or MM-DD-YYYY)\n\n' +
'Find quotes with `/search`. You can enter a word or phrase, and the bot will give you the quotes that match.\n\n' +
'Pull random quotes with `/random`.\n\n' +
'You can receive all the quotes you have saved at any time using `/download`.\n\n' +
'You can receive all the quotes you have saved at any time using `/download`. You can also get a list of authors using `/authors`.\n\n' +
'To `/delete` a quote, you must first use the `/search` command with the `include_identifier` ' +
'option as `true`. This will return an integer ID for the quote. Then, provide that ID to the delete command' +
' (I am open to suggestions on how to make the deletion process easier).\n\n' +
Expand All @@ -38,7 +37,7 @@ module.exports = {
'to moderate quote content. Quote content moderation is thus only about as good as your server\'s moderation.\n\n' +
'**Support:**\n\nFor questions or concerns, you can e-mail the creator at leohfx@gmail.com. Thanks so much for using my bot! :) ' +
'I hope it serves as a nice tool to preserve good memories.\n\n' +
'This bot is open source! Find it at: https://github.com/AlecM33/quote-bot',
'This bot is open source! Find it at: <https://github.com/AlecM33/quote-bot>',
UPDATES_MESSAGE: '**Latest Updates**\n\n**v1.0.2** (11 March 2024)\n- Fixed a bug that prevented the `/authors` command ' +
'from working if the bot\'s reply would exceed Discord\'s maximum message length. Now, if this would be the case, it will attach ' +
'the authors as a file instead. \n\n**1000 quotes!** (28 December 2023)\n- This bot is now storing over 1000 ' +
Expand Down
4 changes: 2 additions & 2 deletions spec/interaction-handlers-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('interaction handlers', () => {
await interactionHandlers.addHandler(interaction);

expect(queries.addQuote).toHaveBeenCalledWith('quote', 'author', '123', undefined);
expect(interaction.reply).toHaveBeenCalledWith('Added the following:\n\n_"test"_ - jane doe');
expect(interaction.reply).toHaveBeenCalledWith('Added the following:\n\n"test" - jane doe');
});

it('should throw a duplicate key exception', async () => {
Expand All @@ -74,7 +74,7 @@ describe('interaction handlers', () => {
await interactionHandlers.addHandler(interaction);
} catch (e) {
expect(queries.addQuote).toThrow();
expect(interaction.reply).toHaveBeenCalledWith(responseMessages.GENERIC_ERROR);
expect(interaction.reply).toHaveBeenCalledWith(responseMessages.GENERIC_INTERACTION_ERROR);
}
});
});
Expand Down

0 comments on commit 5d20680

Please sign in to comment.