General command handlers
Signed-off-by: adithyagenie <adithyagenie@gmail.com>
This commit is contained in:
parent
4119d8a143
commit
01df8c87d7
4 changed files with 35 additions and 14 deletions
10
README.md
10
README.md
|
@ -1,14 +1,10 @@
|
|||
# Force++ (F++)
|
||||
|
||||
Force++ (F++ for short) is a Telegram bot designed to notify users about upcoming coding contests on popular competitive programming platforms. Currently, the bot supports notifications for LeetCode contests, with future plans to include Codeforces and CodeChef contests.
|
||||
|
||||
## Features
|
||||
|
||||
- **LeetCode Contest Notifications**: Get notified about upcoming LeetCode contests.
|
||||
Force++ (F++ for short) is a Telegram bot designed to notify users about upcoming coding contests on popular competitive programming platforms. Currently, the bot supports notifications for LeetCode, Codeforces and CodeChef contests.
|
||||
|
||||
## ⚠️ Development Status
|
||||
|
||||
**Note: This bot is heavily unstable and highly in development.** Use it at your own risk, and expect frequent changes and potential issues. As of now, it only supports LeetCode contest notifications and works for a single group or person configured by the chat ID in environment variables.
|
||||
**Note: This bot is heavily unstable and highly in development.** Use it at your own risk, and expect frequent changes and potential issues. As of now, it works for a single group or person configured by the chat ID in environment variables.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -49,7 +45,7 @@ Force++ (F++ for short) is a Telegram bot designed to notify users about upcomin
|
|||
|
||||
## Usage
|
||||
|
||||
Once the bot is running, it will automatically send notifications about upcoming LeetCode contests to the configured chat ID. Future updates will include notifications for Codeforces and CodeChef contests.
|
||||
Once the bot is running, it will automatically send notifications about upcoming contests to the configured chat ID.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
import { Bot, Context } from "grammy";
|
||||
import { parseMode, ParseModeFlavor } from "@grammyjs/parse-mode";
|
||||
import { startCommand } from "./commands/miscCommands";
|
||||
import { helpCommand, messageSink, setCommands, startCommand } from "./commands/miscCommands";
|
||||
|
||||
|
||||
export const bot = new Bot<ParseModeFlavor<Context>>(`${process.env.BOT_TOKEN}`);
|
||||
export type myBot = Bot<ParseModeFlavor<Context>>;
|
||||
|
||||
export async function botInit() {
|
||||
bot.api.config.use(parseMode("HTML"));
|
||||
setCommands(bot);
|
||||
bot.hears(/^\/start/, async(ctx) => await startCommand(ctx));
|
||||
|
||||
bot.hears(/^\/help/, async(ctx) => await helpCommand(ctx));
|
||||
bot.hears(/.+/, async(ctx) => await messageSink(ctx));
|
||||
console.log("*********************");
|
||||
console.log("Force++ has started!");
|
||||
console.log("*********************");
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { bot } from "../bot";
|
||||
import { CodeforcesAPI } from "codeforces-api-ts";
|
||||
|
||||
export async function reminderContestLC(contestName: string, contestKey: string): Promise<void> {
|
||||
await bot.api.sendMessage(parseInt(process.env.CHAT_ID as string),
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
import { Context } from "grammy";
|
||||
import { Bot, Context } from "grammy";
|
||||
import { myBot } from "../bot";
|
||||
|
||||
export function setCommands(bot: myBot) {
|
||||
void bot.api.setMyCommands([
|
||||
{ command: "start", description: "👀" },
|
||||
{ command: "help", description: "🤨" }
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
export async function startCommand(ctx: Context) {
|
||||
await ctx.reply("Yo!");
|
||||
return;
|
||||
}
|
||||
await ctx.reply(`
|
||||
Hello! 👋 I'm Force++, your coding contest notification bot.
|
||||
🔔 Currently, I'm not open for public use. Stay tuned for future updates.`);
|
||||
}
|
||||
|
||||
export async function helpCommand(ctx: Context) {
|
||||
await ctx.reply(`I'm Force++ (F++), a bot designed to give reminders for contests over different competitive coding platforms.
|
||||
|
||||
⚠️I'm not <b>available for public use</b> and currently under development. Check out my source code over <a href="https://git.ptr.moe/adithyagenie/forceplusplus">here</a>.
|
||||
Designed by @adithyagenie.`)
|
||||
}
|
||||
|
||||
export async function messageSink(ctx: Context) {
|
||||
await ctx.reply(`This bot is not available for public use! Kindly check back later!`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue