A Discord bot that makes dad jokes and more.
This bot was initially created for simple dad jokes but was later generalized to handle any message whenever the user's message meets some criteria.
-
Follow the instructions in create-discord-bot.
Don't forget to give your bot the
Manage Webhooks
permission! -
Download this bot and move the
src-discord-dad-bot
folder into the /src/bots folder from step 1. -
Open config.ts to configure your own settings:
export const configs = [ { label: "Dad Bot", guildId: "258167954913361930", ignoreChannelIds: new Set(["649020657522180128", "258167954913361930"]), username: "Dad", avatarUrls: [ "https://cdn.discordapp.com/attachments/747319121582096434/815053936569352222/5b0821d415e9f917c2730963.png", "https://cdn.discordapp.com/attachments/747319121582096434/815053958074597396/hidethepainharold.png", "https://cdn.discordapp.com/attachments/747319121582096434/815053973702049822/hide-pain-harold-title-red20-web.png", "https://cdn.discordapp.com/attachments/747319121582096434/815053993575055390/Harold.png", "https://cdn.discordapp.com/attachments/747319121582096434/815054009214959646/Hide-the-Pain-Harold-prof.png", "https://cdn.discordapp.com/attachments/747319121582096434/815054022464765963/18622628_146041712604173_5023056421634447578_n.png", ], trigger: (message: Message): boolean => { return /\bi(?:'| +a|’)?m +(.*)/i.test(message.content); }, handleTrigger: async ( message: Message, config: Config ): Promise<void> => { const matches = message.content.match(/\bi(?:'| +a|’)?m +(.*)/i) || []; const capture = matches.slice(1).find((item) => item !== undefined); sendWebhook(message, config, { content: `${message.author}, Hi ${capture}, I'm Dad.`, }); }, chance: 0.1, }, ];
Add as many rules as you want to configure for other servers.
label
is an optional descriptive label for the rule that is used for logging whenever the rule is triggered.guildId
is the server id.ignoreChannelIds
is aSet
of text channel ids the bot ignores user messages from.username
is the display name of the webhook that sends the response message.avatarUrls
are the image urls the webhook randomly picks from to set the avatar.trigger
is a function the bot tests a user message against to determine whether to runhandleTrigger
or not.handleTrigger
is a function the bot runs if the channel criteria,trigger
, andchance
are satisfied.chance
is the percentage chance the bot runshandleTrigger
even if it evaluates totrue
, use values between 0 and 1 (inclusive).
Some useful resources:
-
npm start
to run the bot.
Visit for more help or information!