-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
29 lines (23 loc) · 877 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Bot } from "https://deno.land/x/[email protected]/mod.ts";
const BOT_TOKEN = Deno.env.get("BOT_TOKEN");
if (!BOT_TOKEN) throw new Error("No token.");
const bot = new Bot(BOT_TOKEN);
bot.on(
"message:text",
(ctx) => console.log(ctx.entities(["mention", "text_mention"])),
);
bot.start();
/* bot.on("::bot_command").filter((ctx) => {
return ctx.entities("bot_command").some((entity) => entity.text === "/cc") &&
ctx.entities(["mention", "text_mention"]).length !== 0;
}, (ctx) => {
const ccCommand = ctx.entities("bot_command")
.find((e) => e.text === "/cc");
if (!ccCommand) return;
const textAfter = (ctx.msg.text ?? ctx.msg.caption)
?.slice(ccCommand.offset + ccCommand.length).split("\n")[0];
if (!textAfter) return;
const mentions = ctx.entities(["mention", "text_mention"]);
const afterMentions = mentions.map((e) => {
});
});*/