Meowcord Logo
meowcord

Examples

Explore these example projects to learn how to use meowcord effectively.

Basic Bot
A simple bot with basic commands
index.js
const { Meow, Intents } = require("meowcord");

const bot = new Meow({
  intents: [Intents.Guilds, Intents.GuildMessages, Intents.MessageContent],
  prefix: "!",
  meowSettings: {
    returnBotInfosInConsole: true
  },
});

bot.start("YOUR_BOT_TOKEN");

bot.basicCommand({
  cmdName: "ping",
  cmdCode: async (message) => {
    const ping = Date.now() - message.createdTimestamp;
    message.reply(`šŸ“ Pong! My ping is currently ${ping}ms`);
  }
});

bot.basicCommand({
  cmdName: "hello",
  cmdCode: async (message) => {
    message.reply("Hello there! How can I help you today?");
  }
});
Advanced Commands
Using advanced commands for more control
index.js
const { Meow, Intents } = require("meowcord");

const bot = new Meow({
  intents: [Intents.Guilds, Intents.GuildMessages, Intents.MessageContent],
  prefix: "!",
});

bot.start("YOUR_BOT_TOKEN");

// Advanced command that handles multiple command names
bot.advancedCommand({
  name: "multi-command",
  cmdCode: async (message) => {
    const content = message.content.toLowerCase();
    
    if (content.startsWith("!hello")) {
      message.reply("Hello there!");
    } else if (content.startsWith("!bye")) {
      message.reply("Goodbye!");
    } else if (content.startsWith("!help")) {
      message.reply("Available commands: !hello, !bye, !help");
    }
  }
});
Command Loading
Loading commands from external files

Project structure:

project/
ā”œā”€ā”€ index.js
└── commands/
    ā”œā”€ā”€ ping.js
    ā”œā”€ā”€ help.js
    └── moderation/
        ā”œā”€ā”€ kick.js
        └── ban.js

Main file (index.js):

index.js
const { Meow, Intents } = require("meowcord");
const path = require("path");

const bot = new Meow({
  intents: [Intents.Guilds, Intents.GuildMessages, Intents.MessageContent],
  prefix: "!",
});

// Load all commands from the commands folder
bot.loadCommandFromFolder(path.join(__dirname, "commands"));

bot.start("YOUR_BOT_TOKEN");

Example command file (commands/ping.js):

commands/ping.js
module.exports = {
  cmdName: "ping",
  cmdCode: async (message) => {
    const ping = Date.now() - message.createdTimestamp;
    message.reply(`šŸ“ Pong! My ping is currently ${ping}ms`);
  }
}