Skip to content
Snippets Groups Projects
Commit 06d43edf authored by Joona Kytöniemi's avatar Joona Kytöniemi :sunglasses:
Browse files

Käännöksiä, botti toivottavasti esittelyvalmis

parent 22b112ed
No related branches found
No related tags found
No related merge requests found
Pipeline #63391 passed
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.0.6](https://gitlab.utu.fi/jnkyto/ttl_proj/compare/v0.0.4...v0.0.6) (2023-04-25) ### [0.0.6](https://gitlab.utu.fi/jnkyto/ttl_proj/compare/v0.0.5...v0.0.6) (2023-04-25)
Toiminnallisuus suosikkiravintoloiden tallentamiseksi luotu. Botti lähettää joka päivä viestin sille määrätylle
kanavalle suosikkiravintoloiden ruokalistoista.
### [0.0.5](https://gitlab.utu.fi/jnkyto/ttl_proj/compare/v0.0.4...v0.0.5) (2023-04-24) ### [0.0.5](https://gitlab.utu.fi/jnkyto/ttl_proj/compare/v0.0.4...v0.0.5) (2023-04-24)
Lisätty toiminnallisuus threadien luomiseen päivän ruokalistaa haettaessa. Botti pystyy lähettämään nyt ruokalistat viestinä. Lisätty toiminnallisuus threadien luomiseen päivän ruokalistaa haettaessa. Botti pystyy lähettämään nyt ruokalistat viestinä.
......
...@@ -26,7 +26,7 @@ const checkApiConnection = async () : Promise<string> => { ...@@ -26,7 +26,7 @@ const checkApiConnection = async () : Promise<string> => {
}; };
export const DebugCommand : Command = { export const DebugCommand : Command = {
description: "Debugging command", description: "Debuggauskomento",
name: "debug", name: "debug",
type: 1, type: 1,
run: async(client: Client, interaction: CommandInteraction): Promise<void> => { run: async(client: Client, interaction: CommandInteraction): Promise<void> => {
......
...@@ -9,12 +9,12 @@ import { getIdNamePairs } from "../utils/getIdNamePairs"; ...@@ -9,12 +9,12 @@ import { getIdNamePairs } from "../utils/getIdNamePairs";
let command = { let command = {
name: "favorite", name: "favorite",
description: "used to manage favorites", description: "Käytetään suosikkiravintoloiden hallintaan",
type: 1, // CHAT_INPUT type: 1, // CHAT_INPUT
options: [ options: [
{ {
name: "add", name: "add",
description: "Add restaurant to favorites", description: "Lisää ravintola suosikkeihin",
type: 1, type: 1,
options: [ options: [
{ {
...@@ -28,12 +28,12 @@ let command = { ...@@ -28,12 +28,12 @@ let command = {
}, },
{ {
name: "remove", name: "remove",
description: "Remove restaurant from favorites", description: "Poista ravintola suosikeista",
type: 1, type: 1,
options: [ options: [
{ {
name: "restaurant", name: "restaurant",
description: "ravintola", description: "Ravintola",
type: 3, type: 3,
required: true, required: true,
choices: [] as RestaurantIdNamePair[] //fetched below with getIdnamePairs() choices: [] as RestaurantIdNamePair[] //fetched below with getIdnamePairs()
...@@ -54,11 +54,11 @@ let command = { ...@@ -54,11 +54,11 @@ let command = {
switch (interaction.options.data[0].name) { switch (interaction.options.data[0].name) {
case "add": case "add":
addFavoriteToFile(restaurantEntryId, guild.id, "./data/favorites.json"); addFavoriteToFile(restaurantEntryId, guild.id, "./data/favorites.json");
message = "Restaurant added to favorites!"; message = "Ravintola lisätty suosikkeihin!";
break; break;
case "remove": case "remove":
removeFavoriteFromFile(restaurantEntryId, guild.id, "./data/favorites.json"); removeFavoriteFromFile(restaurantEntryId, guild.id, "./data/favorites.json");
message = "Restaurant removed from favorites!"; message = "Ravintola poistettu suosikeista!";
break; break;
default: default:
// await interaction.followUp("Virheellinen alakomento. Ei oo mun vika bro."); // await interaction.followUp("Virheellinen alakomento. Ei oo mun vika bro.");
......
...@@ -4,7 +4,7 @@ import {Command} from "../interfaces/Command"; ...@@ -4,7 +4,7 @@ import {Command} from "../interfaces/Command";
import {getRandomInt} from "../utils/getRandomInt"; import {getRandomInt} from "../utils/getRandomInt";
let insults = [ let insults = [
"The insults.json file was not found. Check if it exists in the /data/-folder, dumbass. Regards, Gordon" "The insults.json file was not found. Check if it exists in the /data/-folder, dumbass. Regards, Gordon."
]; ];
try { try {
......
...@@ -109,12 +109,12 @@ let command = { ...@@ -109,12 +109,12 @@ let command = {
if(messages[messageIndex].length + daymenu.length <= 2000){ if(messages[messageIndex].length + daymenu.length <= 2000){
messages[messageIndex] += daymenu; messages[messageIndex] += daymenu;
} else { } else {
console.log(messages[messageIndex]); console.debug(messages[messageIndex]);
interaction.followUp(messages[messageIndex]); interaction.followUp(messages[messageIndex]);
messages[++messageIndex] = `Vastauksen osa ${messageIndex + 1} (Discord-viestin enimmäismerkkimäärä ylitetty)\n` + daymenu; messages[++messageIndex] = `Vastauksen osa ${messageIndex + 1} (Discord-viestin enimmäismerkkimäärä ylitetty)\n` + daymenu;
} }
} }
console.log(messages[messageIndex]); console.debug(messages[messageIndex]);
interaction.followUp(messages[messageIndex]); interaction.followUp(messages[messageIndex]);
}) })
.catch(e => { .catch(e => {
......
...@@ -12,7 +12,7 @@ export default (client: Client): void => { ...@@ -12,7 +12,7 @@ export default (client: Client): void => {
const handleSlashCommand = async (client: Client, interaction: CommandInteraction): Promise<void> => { const handleSlashCommand = async (client: Client, interaction: CommandInteraction): Promise<void> => {
const slashCommand = getCommands().find(cmd => cmd.name === interaction.commandName); const slashCommand = getCommands().find(cmd => cmd.name === interaction.commandName);
if (!slashCommand) { if (!slashCommand) {
await interaction.followUp({content: "An oopsie woopsie has occurred!"}); await interaction.followUp({content: "Odottamaton virhe tapahtui. Hups!"});
return; return;
} }
await interaction.deferReply(); await interaction.deferReply();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment