added embed for /hilfe
This commit is contained in:
parent
8935e141d2
commit
e7cd840c48
BIN
icon/mo_Avocadi_Avatar_Closeup_2.png
Normal file
BIN
icon/mo_Avocadi_Avatar_Closeup_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
22
src/actions/help/help.components.ts
Normal file
22
src/actions/help/help.components.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Commands, CommandsMeta } from 'commands';
|
||||
import { AttachmentBuilder, EmbedBuilder } from 'discord.js';
|
||||
|
||||
export default function createEmbed() { // ({ embeds: [exampleEmbed] })
|
||||
console.log("createEmbed()");
|
||||
|
||||
const exampleEmbed = new EmbedBuilder()
|
||||
.setColor(0x004400)
|
||||
//.setTitle("/hilfe")
|
||||
//.setURL("")
|
||||
.setAuthor({ name: "avocadi - befehle", iconURL: "https://media.discordapp.net/attachments/1321933410188656693/1323447010380222474/mo_Avocadi_Avatar_Closeup_2.png?ex=67748b93&is=67733a13&hm=f48efb3523bca5f50e79144c7b41a127c94670e693e3da3dc2e6ffe62ad8a769&=&format=webp&quality=lossless&width=1524&height=1524", url: 'https://git.unom.io/moriese/avocadi-bot' })
|
||||
.setDescription(" ")
|
||||
.addFields(
|
||||
{ name: "/" + Commands.Enum.giessen, value: CommandsMeta.giessen.description },
|
||||
{ name: "/" + Commands.Enum.medikamente, value: CommandsMeta.medikamente.description },
|
||||
{ name: "/" + Commands.Enum.hilfe, value: CommandsMeta.hilfe.description },
|
||||
)
|
||||
.setTimestamp()
|
||||
//.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
|
||||
;
|
||||
return exampleEmbed;
|
||||
}
|
20
src/actions/help/help.service.ts
Normal file
20
src/actions/help/help.service.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import type { CacheType, Interaction } from "discord.js";
|
||||
import createEmbed from "./help.components";
|
||||
|
||||
export class HelpService {
|
||||
exampleEmbed: any;
|
||||
|
||||
constructor() {
|
||||
this.exampleEmbed = createEmbed();
|
||||
}
|
||||
|
||||
async handleInteraction(interaction: Interaction<CacheType>) {
|
||||
console.log("help");
|
||||
|
||||
if (interaction.isChatInputCommand()) {
|
||||
await interaction.reply({
|
||||
embeds: [this.exampleEmbed],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
34
src/commands/index.ts
Normal file
34
src/commands/index.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { z } from "zod";
|
||||
|
||||
export const Commands = z.enum(["giessen", "medikamente", "hilfe"]);
|
||||
|
||||
export const CommandsMeta: Record<z.output<typeof Commands>, { description: string }> = {
|
||||
giessen: {
|
||||
description: "giess mich mit etwas wasser :3"
|
||||
},
|
||||
medikamente: {
|
||||
description: "ich erinnere dich gerne daran, deine medikamente zu nehmen! :)"
|
||||
},
|
||||
hilfe: {
|
||||
description: "ich schreibe dir auf, was du alles mit mir machen kannst :)"
|
||||
}
|
||||
}
|
||||
|
||||
export type CommandsType = z.output<typeof Commands>;
|
||||
|
||||
export default function getCommands() {
|
||||
const commands = [
|
||||
new SlashCommandBuilder()
|
||||
.setName(Commands.Enum.giessen)
|
||||
.setDescription(CommandsMeta.giessen.description),
|
||||
new SlashCommandBuilder()
|
||||
.setName(Commands.Enum.medikamente)
|
||||
.setDescription(CommandsMeta.medikamente.description),
|
||||
new SlashCommandBuilder()
|
||||
.setName(Commands.Enum.hilfe)
|
||||
.setDescription(CommandsMeta.hilfe.description),
|
||||
].map((command) => command.toJSON());
|
||||
|
||||
return commands;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { z } from "zod";
|
||||
|
||||
export const Commands = z.enum(["giessen", "medikamente"]);
|
||||
export type CommandsType = z.output<typeof Commands>;
|
||||
|
||||
export default function getCommands() {
|
||||
const commands = [
|
||||
new SlashCommandBuilder()
|
||||
.setName(Commands.Enum.giessen)
|
||||
.setDescription("giess mich mit etwas wasser :3"),
|
||||
|
||||
new SlashCommandBuilder()
|
||||
.setName(Commands.Enum.medikamente)
|
||||
.setDescription("ich erinnere dich gerne daran, deine medikamente zu nehmen! :)"),
|
||||
].map((command) => command.toJSON());
|
||||
|
||||
return commands;
|
||||
}
|
24
src/components/index.ts
Normal file
24
src/components/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { EmbedBuilder } from "discord.js";
|
||||
import { Commands, CommandsMeta } from "commands";
|
||||
|
||||
export default function getEmbed() { // channel.send({ embeds: [exampleEmbed] });
|
||||
const exampleEmbed = new EmbedBuilder()
|
||||
.setColor(0x0099FF)
|
||||
.setTitle('Some title')
|
||||
.setURL('https://discord.js.org/')
|
||||
.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
|
||||
.setDescription('Some description here')
|
||||
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
|
||||
.addFields(
|
||||
{ name: Commands.Enum.giessen, value: CommandsMeta.giessen.description },
|
||||
{ name: Commands.Enum.medikamente, value: CommandsMeta.medikamente.description },
|
||||
{ name: Commands.Enum.hilfe, value: CommandsMeta.hilfe.description },
|
||||
{ name: '\u200B', value: '\u200B' },
|
||||
{ name: 'Inline field title', value: 'Some value here', inline: true },
|
||||
)
|
||||
.addFields({ name: 'Inline field title', value: 'Some value here', inline: true })
|
||||
.setImage('https://i.imgur.com/AfFp7pu.png')
|
||||
.setTimestamp()
|
||||
.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });
|
||||
return exampleEmbed;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { Commands, type CommandsType } from "components/commands.component";
|
||||
import { Commands, type CommandsType } from "commands";
|
||||
import type {
|
||||
ButtonInteraction,
|
||||
CacheType,
|
||||
@ -9,20 +9,24 @@ import type {
|
||||
import client from "lib/client";
|
||||
import EventEmitter from "node:events";
|
||||
import DiscordService from "services/discord.service";
|
||||
import { WaterMeService } from "actions/waterMe/waterMe.service";
|
||||
import config from "config";
|
||||
import { WaterMeService } from "actions/waterMe/waterMe.service";
|
||||
import { MedicationService } from "actions/medication/medication.service";
|
||||
import { HelpService } from "actions/help/help.service";
|
||||
import { custom } from "zod";
|
||||
|
||||
export default class DiscordController extends EventEmitter {
|
||||
private discordService!: DiscordService;
|
||||
waterMeService: WaterMeService;
|
||||
medicationService: MedicationService;
|
||||
helpService: HelpService;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.discordService = new DiscordService();
|
||||
this.waterMeService = new WaterMeService();
|
||||
this.medicationService = new MedicationService();
|
||||
this.helpService = new HelpService();
|
||||
// log when running
|
||||
client.once("ready", async () => {
|
||||
client.user?.setActivity("HALLOOO HOERT IHR MICH?", { type: 4 });
|
||||
@ -36,7 +40,7 @@ export default class DiscordController extends EventEmitter {
|
||||
|
||||
if (channel?.isTextBased && channel?.isSendable()) {
|
||||
await channel.send({
|
||||
content: "bin gerade erst aufgewacht :o",
|
||||
content: "bin wieder da :o war kurz weg :3",
|
||||
});
|
||||
}*/
|
||||
});
|
||||
@ -69,7 +73,7 @@ export default class DiscordController extends EventEmitter {
|
||||
const { customId } = interaction;
|
||||
console.log(interaction.customId);
|
||||
|
||||
if (customId === "moreWater") {
|
||||
if (customId.toLowerCase().includes("moreWater")) {
|
||||
await this.waterMeService.handleInteraction(interaction);
|
||||
}
|
||||
if (customId.toLowerCase().includes("medication")) {
|
||||
@ -90,6 +94,9 @@ export default class DiscordController extends EventEmitter {
|
||||
case Commands.Enum.medikamente:
|
||||
await this.medicationService.handleInteraction(interaction);
|
||||
return;
|
||||
case Commands.Enum.hilfe:
|
||||
await this.helpService.handleInteraction(interaction);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Routes } from "discord.js";
|
||||
import { REST } from "@discordjs/rest";
|
||||
import config from "config";
|
||||
import getCommands from "components/commands.component";
|
||||
import getCommands from "commands";
|
||||
|
||||
export default class DiscordService {
|
||||
rest: REST;
|
||||
|
Loading…
x
Reference in New Issue
Block a user