diff --git a/README.md b/README.md index 4be4f95..f5b9ef5 100644 --- a/README.md +++ b/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 diff --git a/src/bot/bot.ts b/src/bot/bot.ts index cbc64c8..41bf742 100644 --- a/src/bot/bot.ts +++ b/src/bot/bot.ts @@ -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>(`${process.env.BOT_TOKEN}`); +export type myBot = Bot>; + 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("*********************"); diff --git a/src/bot/commands/contestRem.ts b/src/bot/commands/contestRem.ts index 34ae496..5f6e29e 100644 --- a/src/bot/commands/contestRem.ts +++ b/src/bot/commands/contestRem.ts @@ -1,5 +1,4 @@ import { bot } from "../bot"; -import { CodeforcesAPI } from "codeforces-api-ts"; export async function reminderContestLC(contestName: string, contestKey: string): Promise { await bot.api.sendMessage(parseInt(process.env.CHAT_ID as string), diff --git a/src/bot/commands/miscCommands.ts b/src/bot/commands/miscCommands.ts index fb5b15b..74a1c17 100644 --- a/src/bot/commands/miscCommands.ts +++ b/src/bot/commands/miscCommands.ts @@ -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; -} \ No newline at end of file + 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 available for public use and currently under development. Check out my source code over here. +Designed by @adithyagenie.`) +} + +export async function messageSink(ctx: Context) { + await ctx.reply(`This bot is not available for public use! Kindly check back later!`); +} +