Skip to content

Commit

Permalink
discord
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Jan 29, 2025
1 parent 418bcec commit 841f0d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/example-discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ async function main() {
const discord = new DiscordClient(
{
discord_token: env.DISCORD_TOKEN,
discord_bot_name: "DeepLoaf",
},
loglevel
);
Expand Down
9 changes: 7 additions & 2 deletions packages/core/src/core/io/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { z } from "zod";

export interface DiscordCredentials {
discord_token: string;
discord_bot_name: string;
}

export interface MessageData {
Expand Down Expand Up @@ -82,8 +83,12 @@ export class DiscordClient {
// Here, you could decide what "data" looks like
// E.g., check if the bot was mentioned, etc.

if (message.author.displayName == "DeepLoaf") {
console.log("Skipping message from DeepLoaf");
if (
message.author.displayName == this.credentials.discord_bot_name
) {
console.log(
`Skipping message from ${this.credentials.discord_bot_name}`
);
return;
}

Expand Down

0 comments on commit 841f0d0

Please sign in to comment.