Browse Source

Implementation of Joystream Scoring Periods Telegram BOT

Oleksandr Korniienko 3 years ago
parent
commit
3f6b708c2f

+ 3 - 3
community-contributions/joystream-scoring-period-bot/src/bot-en.ts

@@ -54,7 +54,7 @@ bot.on("message", async (msg: TelegramBot.Message) => {
 
     const userParsed = `[${username}](tg://user?id=${msg.from.id})`;
     const leaderboardLink = `[Check scores](https://t.me/JoystreamLeaderboardBot)`;
-    const options: SendMessageOptions = { parse_mode: "Markdown" };
+    const options: SendMessageOptions = { parse_mode: "Markdown", disable_web_page_preview: true };
 
     if (msg.text?.startsWith("/scoring")) {
       const startDate = moment.parseZone(
@@ -78,7 +78,7 @@ bot.on("message", async (msg: TelegramBot.Message) => {
       const currentPeriodId = scoringData.currentScoringPeriod.scoringPeriodId;
       const prevPeriodId = scoringData.currentScoringPeriod.scoringPeriodId - 1;
       const currentScoring = `The current scoring period ***#${currentPeriodId}*** ends in ${daysLeft}\n`;
-      const currentDeadline = `Please make sure to submit your report for the period ***#${currentPeriodId}*** before the deadline ***${deadline}***\n`;
+      const currentDeadline = `Please make sure to [submit your report](https://www.joystream.org/founding-members/form) for period ***#${currentPeriodId}*** before the deadline ***${deadline}***\n`;
       const isLastScoringClosed = endDate
         .add(5, "d")
         .subtract(2, "w")
@@ -86,7 +86,7 @@ bot.on("message", async (msg: TelegramBot.Message) => {
       const previousPeriodDeadline = isLastScoringClosed
         ? `Reports for the previous period ***#${prevPeriodId}*** are closed\n`
         : `Reports for the previous period ***#${prevPeriodId}*** can be submitted before ***${prevDeadline}***\n`;
-      const latestGradedPeriod = `Latest graded period - ***#${lastGradedPeriod}***\n${leaderboardLink}`;
+      const latestGradedPeriod = `Latest graded period - ***#${lastGradedPeriod}*** - ${leaderboardLink}`;
       const messageContent = `${hello}${currentScoring}${currentDeadline}${previousPeriodDeadline}${latestGradedPeriod}`;
       bot.sendMessage(chatId, messageContent, options).then((message) => {
         try {

+ 3 - 3
community-contributions/joystream-scoring-period-bot/src/bot-ru.ts

@@ -54,7 +54,7 @@ bot.on("message", async (msg: TelegramBot.Message) => {
 
     const userParsed = `[${username}](tg://user?id=${msg.from.id})`;
     const leaderboardLink = `[Проверить баллы](https://t.me/JoystreamLeaderboardBot)`;
-    const options: SendMessageOptions = { parse_mode: "Markdown" };
+    const options: SendMessageOptions = { parse_mode: "Markdown", disable_web_page_preview: true };
 
     if (msg.text?.startsWith("/scoring")) {
       const startDate = moment.parseZone(
@@ -84,7 +84,7 @@ bot.on("message", async (msg: TelegramBot.Message) => {
       const currentPeriodId = scoringData.currentScoringPeriod.scoringPeriodId;
       const prevPeriodId = scoringData.currentScoringPeriod.scoringPeriodId - 1;
       const currentScoring = `Текущий отчетный период ***#${currentPeriodId}*** заканчивается через ${daysLeft}\n`;
-      const currentDeadline = `Успей подать отчет за период ***#${currentPeriodId}*** до окончания срока подачи ***${deadline}***\n`;
+      const currentDeadline = `Успей [подать отчет](https://www.joystream.org/founding-members/form) за период ***#${currentPeriodId}*** до окончания срока подачи ***${deadline}***\n`;
       const isLastScoringClosed = endDate
         .add(5, "d")
         .subtract(2, "w")
@@ -92,7 +92,7 @@ bot.on("message", async (msg: TelegramBot.Message) => {
       const previousPeriodDeadline = isLastScoringClosed
         ? `Подача отчетов за прошлый период ***#${prevPeriodId}*** окончена\n`
         : `Подача отчетов за прошлый период ***#${prevPeriodId}*** открыта до ***${prevDeadline}***\n`;
-      const latestGradedPeriod = `Последний период с начисленными баллами - ***#${lastGradedPeriod}***\n${leaderboardLink}`;
+      const latestGradedPeriod = `Последний период с начисленными баллами - ***#${lastGradedPeriod}*** - ${leaderboardLink}`;
       const messageContent = `${hello}${currentScoring}${currentDeadline}${previousPeriodDeadline}${latestGradedPeriod}`;
       bot.sendMessage(chatId, messageContent, options).then((message) => {
         try {