commands support, kofi, disboard, discardia
All checks were successful
release-tag / release-image (push) Successful in 33s
All checks were successful
release-tag / release-image (push) Successful in 33s
This commit is contained in:
parent
f77e292e27
commit
ee73dc140a
@ -14,6 +14,10 @@ export default function createEmbed() { // ({ embeds: [exampleEmbed] })
|
|||||||
{ name: `/${Commands.Enum.giessen}`, value: CommandsMeta.giessen.description },
|
{ name: `/${Commands.Enum.giessen}`, value: CommandsMeta.giessen.description },
|
||||||
{ name: `/${Commands.Enum.medikamente}`, value: CommandsMeta.medikamente.description },
|
{ name: `/${Commands.Enum.medikamente}`, value: CommandsMeta.medikamente.description },
|
||||||
{ name: `/${Commands.Enum.hilfe}`, value: CommandsMeta.hilfe.description },
|
{ name: `/${Commands.Enum.hilfe}`, value: CommandsMeta.hilfe.description },
|
||||||
|
{ name: `/${Commands.Enum.support}`, value: CommandsMeta.support.description },
|
||||||
|
{ name: `/${Commands.Enum.kofi}`, value: CommandsMeta.kofi.description },
|
||||||
|
{ name: `/${Commands.Enum.disboard}`, value: CommandsMeta.disboard.description },
|
||||||
|
{ name: `/${Commands.Enum.discadia}`, value: CommandsMeta.discadia.description },
|
||||||
)
|
)
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
//.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
|
//.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
|
||||||
|
@ -15,6 +15,7 @@ export class HelpService {
|
|||||||
if (interaction.isChatInputCommand()) {
|
if (interaction.isChatInputCommand()) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [this.exampleEmbed],
|
embeds: [this.exampleEmbed],
|
||||||
|
ephemeral: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/actions/support/support.components.ts
Normal file
18
src/actions/support/support.components.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { createEmbed } from "actions/customMessage/customMessage.components";
|
||||||
|
|
||||||
|
const kofiTitle = "ko-fi";
|
||||||
|
const kofiLink = "[ko-fi.com/avocadi](https://ko-fi.com/avocadi)";
|
||||||
|
const kofiDesc = "gerne kannst du uns eine kleine spende ueber ko-fi zukommen lassen!";
|
||||||
|
|
||||||
|
const disboardTitle = "disboard";
|
||||||
|
const disboardLink = "[disboard.org/de/server/1316153371899592774](https://disboard.org/de/server/1316153371899592774)";
|
||||||
|
const disboardDesc = "hier kannst du eine bewertung schreiben <3";
|
||||||
|
|
||||||
|
const discadiaTitle = "discadia";
|
||||||
|
const discadiaLink = "[discadia.com/server/avocadi](https://discadia.com/server/avocadi/)";
|
||||||
|
const discadiaDesc = "du moechtest fuer uns voten? dann klicke auf den link :)";
|
||||||
|
|
||||||
|
export const supportContent = createEmbed("support", (`${kofiTitle}: ${kofiLink}\n${disboardTitle}: ${disboardLink}\n${discadiaTitle}: ${discadiaLink}`));
|
||||||
|
export const kofiContent = createEmbed(kofiTitle, (`${kofiDesc}\n${kofiLink}`));
|
||||||
|
export const disboardContent = createEmbed(disboardTitle, (`${disboardDesc}\n${disboardLink}`));
|
||||||
|
export const discadiaContent = createEmbed(discadiaTitle, (`${discadiaDesc}\n${discadiaLink}`));
|
93
src/actions/support/support.service.ts
Normal file
93
src/actions/support/support.service.ts
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
import config from "config";
|
||||||
|
import client from "lib/client";
|
||||||
|
import { getRandomInt } from "lib/utils";
|
||||||
|
import {
|
||||||
|
kofiContent,
|
||||||
|
supportContent,
|
||||||
|
discadiaContent,
|
||||||
|
disboardContent,
|
||||||
|
} from "./support.components.ts";
|
||||||
|
import type {
|
||||||
|
CacheType,
|
||||||
|
Interaction,
|
||||||
|
ChatInputCommandInteraction,
|
||||||
|
} from "discord.js";
|
||||||
|
import { Commands, type CommandsType } from "commands/index.ts";
|
||||||
|
|
||||||
|
export class SupportService {
|
||||||
|
async handleInteraction(interaction: Interaction<CacheType>) {
|
||||||
|
if (interaction.isChatInputCommand()) {
|
||||||
|
await this.handleChatInputCommand(interaction);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async handleChatInputCommand(
|
||||||
|
interaction: ChatInputCommandInteraction<CacheType>,
|
||||||
|
) {
|
||||||
|
const commandName = interaction.commandName as CommandsType;
|
||||||
|
switch (commandName) {
|
||||||
|
case Commands.Enum.support:
|
||||||
|
await this.supportCommand(interaction);
|
||||||
|
return;
|
||||||
|
case Commands.Enum.kofi:
|
||||||
|
await this.kofiCommand(interaction);
|
||||||
|
return;
|
||||||
|
case Commands.Enum.disboard:
|
||||||
|
await this.disboardCommand(interaction);
|
||||||
|
return;
|
||||||
|
case Commands.Enum.discadia:
|
||||||
|
await this.discadiaCommand(interaction);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async supportCommand(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||||
|
console.log("supportCommand");
|
||||||
|
try {
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [supportContent],
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error while sending supportCommand msg:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async kofiCommand(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||||
|
console.log("kofiCommand");
|
||||||
|
try {
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [kofiContent],
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error while sending kofiCommand msg:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async disboardCommand(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||||
|
console.log("disboardCommand");
|
||||||
|
try {
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [disboardContent],
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error while sending disboardCommand msg:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async discadiaCommand(interaction: ChatInputCommandInteraction<CacheType>) {
|
||||||
|
console.log("discadiaCommand");
|
||||||
|
try {
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [discadiaContent],
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error while sending discadiaCommand msg:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
import { SlashCommandBuilder, userMention } from "discord.js";
|
import { SlashCommandBuilder, userMention } from "discord.js";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const Commands = z.enum(["giessen", "medikamente", "hilfe", "accept", "welcome", "embed", "message", "reminder"]);
|
export const Commands = z.enum(["giessen", "medikamente", "hilfe", "support", "kofi", "disboard", "discadia", "accept", "welcome", "embed", "message", "reminder"]);
|
||||||
|
|
||||||
export const CommandsMeta: Record<z.output<typeof Commands>, { description: string }> = {
|
export const CommandsMeta: Record<z.output<typeof Commands>, { description: string }> = {
|
||||||
giessen: {
|
giessen: {
|
||||||
@ -13,6 +13,18 @@ export const CommandsMeta: Record<z.output<typeof Commands>, { description: stri
|
|||||||
hilfe: {
|
hilfe: {
|
||||||
description: "ich schreibe dir auf, was du alles mit mir machen kannst :)"
|
description: "ich schreibe dir auf, was du alles mit mir machen kannst :)"
|
||||||
},
|
},
|
||||||
|
support: {
|
||||||
|
description: "unterstuetze uns! link zu unserem ko-fi, disboard und discardia c:"
|
||||||
|
},
|
||||||
|
kofi: {
|
||||||
|
description: "link zu unserem ko-fi (spendenportal):"
|
||||||
|
},
|
||||||
|
disboard: {
|
||||||
|
description: "link zu disboard, hier kannst du uns bewerten!"
|
||||||
|
},
|
||||||
|
discadia: {
|
||||||
|
description: "link zu discadia, hier kannst du fuer uns voten!"
|
||||||
|
},
|
||||||
accept: {
|
accept: {
|
||||||
description: "admin use only"
|
description: "admin use only"
|
||||||
},
|
},
|
||||||
@ -43,6 +55,18 @@ export default function getCommands() {
|
|||||||
new SlashCommandBuilder()
|
new SlashCommandBuilder()
|
||||||
.setName(Commands.Enum.hilfe)
|
.setName(Commands.Enum.hilfe)
|
||||||
.setDescription(CommandsMeta.hilfe.description),
|
.setDescription(CommandsMeta.hilfe.description),
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName(Commands.Enum.support)
|
||||||
|
.setDescription(CommandsMeta.support.description),
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName(Commands.Enum.kofi)
|
||||||
|
.setDescription(CommandsMeta.kofi.description),
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName(Commands.Enum.disboard)
|
||||||
|
.setDescription(CommandsMeta.disboard.description),
|
||||||
|
new SlashCommandBuilder()
|
||||||
|
.setName(Commands.Enum.discadia)
|
||||||
|
.setDescription(CommandsMeta.discadia.description),
|
||||||
new SlashCommandBuilder()
|
new SlashCommandBuilder()
|
||||||
.setName(Commands.Enum.accept)
|
.setName(Commands.Enum.accept)
|
||||||
.setDescription(CommandsMeta.accept.description)
|
.setDescription(CommandsMeta.accept.description)
|
||||||
|
@ -17,6 +17,7 @@ import DiscordService from "services/discord.service";
|
|||||||
import { WaterMeService } from "actions/waterMe/waterMe.service";
|
import { WaterMeService } from "actions/waterMe/waterMe.service";
|
||||||
import { MedicationService } from "actions/medication/medication.service";
|
import { MedicationService } from "actions/medication/medication.service";
|
||||||
import { HelpService } from "actions/help/help.service";
|
import { HelpService } from "actions/help/help.service";
|
||||||
|
import { SupportService } from "actions/support/support.service";
|
||||||
import { GreetingService } from "actions/greeting/greeting.service";
|
import { GreetingService } from "actions/greeting/greeting.service";
|
||||||
import { ActivityService } from "actions/activity/activity.service";
|
import { ActivityService } from "actions/activity/activity.service";
|
||||||
import { DmService } from "actions/dm/dm.service";
|
import { DmService } from "actions/dm/dm.service";
|
||||||
@ -31,6 +32,7 @@ export default class DiscordController extends EventEmitter {
|
|||||||
greetingService: GreetingService;
|
greetingService: GreetingService;
|
||||||
medicationService: MedicationService;
|
medicationService: MedicationService;
|
||||||
helpService: HelpService;
|
helpService: HelpService;
|
||||||
|
supportService: SupportService;
|
||||||
activityService: ActivityService;
|
activityService: ActivityService;
|
||||||
dmService: DmService;
|
dmService: DmService;
|
||||||
customMessageService: CustomMessageService;
|
customMessageService: CustomMessageService;
|
||||||
@ -46,6 +48,7 @@ export default class DiscordController extends EventEmitter {
|
|||||||
this.greetingService = new GreetingService();
|
this.greetingService = new GreetingService();
|
||||||
this.medicationService = new MedicationService();
|
this.medicationService = new MedicationService();
|
||||||
this.helpService = new HelpService();
|
this.helpService = new HelpService();
|
||||||
|
this.supportService = new SupportService();
|
||||||
this.activityService = new ActivityService();
|
this.activityService = new ActivityService();
|
||||||
this.dmService = new DmService();
|
this.dmService = new DmService();
|
||||||
this.customMessageService = new CustomMessageService();
|
this.customMessageService = new CustomMessageService();
|
||||||
@ -203,28 +206,32 @@ export default class DiscordController extends EventEmitter {
|
|||||||
// add commands
|
// add commands
|
||||||
switch (commandName) {
|
switch (commandName) {
|
||||||
case Commands.Enum.giessen:
|
case Commands.Enum.giessen:
|
||||||
await this.waterMeService.handleInteraction(interaction);
|
await this.waterMeService.handleInteraction(interaction); // zu chatinputcommand wechseln
|
||||||
return;
|
return;
|
||||||
case Commands.Enum.medikamente:
|
case Commands.Enum.medikamente:
|
||||||
await this.medicationService.handleInteraction(interaction);
|
await this.medicationService.handleChatInputCommand(interaction);
|
||||||
return;
|
return;
|
||||||
case Commands.Enum.hilfe:
|
case Commands.Enum.hilfe:
|
||||||
await this.helpService.handleInteraction(interaction);
|
await this.helpService.handleInteraction(interaction); // zu chatinputcommand wechseln
|
||||||
|
return;
|
||||||
|
case Commands.Enum.support:
|
||||||
|
case Commands.Enum.kofi:
|
||||||
|
case Commands.Enum.disboard:
|
||||||
|
case Commands.Enum.discadia:
|
||||||
|
await this.supportService.handleInteraction(interaction);
|
||||||
return;
|
return;
|
||||||
case Commands.Enum.accept:
|
case Commands.Enum.accept:
|
||||||
await this.greetingService.handleInteraction(interaction);
|
await this.greetingService.handleChatInputCommand(interaction);
|
||||||
return;
|
return;
|
||||||
case Commands.Enum.welcome:
|
case Commands.Enum.welcome:
|
||||||
await this.greetingService.handleInteraction(interaction);
|
await this.greetingService.handleChatInputCommand(interaction);
|
||||||
return;
|
return;
|
||||||
case Commands.Enum.embed:
|
case Commands.Enum.embed:
|
||||||
await this.customMessageService.handleInteraction(interaction);
|
|
||||||
return;
|
|
||||||
case Commands.Enum.message:
|
case Commands.Enum.message:
|
||||||
await this.customMessageService.handleInteraction(interaction);
|
await this.customMessageService.handleChatInputCommand(interaction);
|
||||||
return;
|
return;
|
||||||
case Commands.Enum.reminder:
|
case Commands.Enum.reminder:
|
||||||
await this.greetingService.handleInteraction(interaction);
|
await this.greetingService.handleChatInputCommand(interaction);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user