% bun i meinu
import { Meinu, Command } from 'meinu';
let commands = [
new Command<Meinu>({
name: 'ping',
description: 'Pong!',
owners_only: true, // default: false
nsfw: true, // default: false
}).addHandler('chat_input', async (bot, int) => {
const sent = await int.deferReply({ withResponse: true });
if (!sent.resource?.message?.createdTimestamp)
return int.editReply('An error occured while executing the command.');
const diff = sent.resource?.message?.createdTimestamp - int.createdTimestamp;
const content = [
'### 🏓 Pong!',
`## ${diff}ms`,
...(bot.isSharding ? [`-# via shard #${bot.shardId}`] : []),
].join('\n');
return int.editReply(content);
})
];
new Meinu({
name: 'MyBot',
color: 'LuminousVividPink',
})
.register_commands(commands)
.init(); // starts the bot, .init(TOKEN) if `TOKEN` env is not set
Meinu includes a class called Scrollable
which can be used to create scrollable content.
To initate this class, you can use the create_scrollable
function.
import { Command, create_scrollable } from 'meinu';
new Command({})
.addHandler("chat_input", (bot, int) => create_scrollable({
int,
data: () => [{ title: "foo" }, { title: "bar" }],
match: (v) => ({
content: `## ${v.title}`
})
}));