Browse Source

Drop obsolete variables

traumschule 4 years ago
parent
commit
53c2d8c4a7

+ 8 - 3
community-contributions/joystreamtelegrambot/src/bot.ts

@@ -4,7 +4,6 @@ import { token, chatid, wsLocation } from "../config";
 // types
 import { Options, Proposals } from "./types";
 import { types } from "@joystream/types";
-import { CategoryId } from "@joystream/types/forum";
 import { ApiPromise, WsProvider } from "@polkadot/api";
 import { Header } from "@polkadot/types/interfaces";
 
@@ -19,8 +18,14 @@ process.env.NTBA_FIX_319 ||
   log("TL;DR: Set NTBA_FIX_319 to hide this warning.");
 
 const bot = new TelegramBot(token, { polling: true });
-const sendMessage = (msg: string) =>
-  bot.sendMessage(chatid, msg, { parse_mode: "HTML" });
+
+const sendMessage = (msg: string) => {
+  try {
+    //bot.sendMessage(chatid, msg, { parse_mode: "HTML" });
+  } catch (e) {
+    console.log(`Failed to send message: ${e}`);
+  }
+};
 
 const main = async () => {
   const provider = new WsProvider(wsLocation);

+ 3 - 5
community-contributions/joystreamtelegrambot/src/lib/announcements.ts

@@ -1,9 +1,8 @@
 import { Api, Member, ProposalDetail, Proposals } from "../types";
-import { AccountId, BlockNumber } from "@polkadot/types/interfaces";
+import { BlockNumber } from "@polkadot/types/interfaces";
 import { Channel, ElectionStage } from "@joystream/types/augment";
-import { MemberId, Membership } from "@joystream/types/members";
 //import { Channel } from "@joystream/types/channel";
-import { Category, CategoryId, Thread, Post } from "@joystream/types/forum";
+import { Category, Thread, Post } from "@joystream/types/forum";
 import { domain } from "../../config";
 import {
   categoryById,
@@ -176,9 +175,8 @@ const processPending = async (
   details: ProposalDetail,
   sendMessage: (s: string) => void
 ): Promise<boolean> => {
-  const { createdAt, message, parameters, result, stage } = details;
+  const { createdAt, message, parameters, stage } = details;
   if (stage === "Finalized") return processActive(id, details, sendMessage);
-  const label = stage;
   const votingEndsAt = createdAt + parameters.votingPeriod.toNumber();
   const msg = `Proposal ${id} <b>created</b> at block ${createdAt}.\r\n${message}\r\nYou can vote until block ${votingEndsAt}.`;
   sendMessage(msg);

+ 3 - 4
community-contributions/joystreamtelegrambot/src/tests.ts

@@ -1,10 +1,9 @@
 //import TelegramBot from "node-telegram-bot-api";
-import { token, chatid, wsLocation } from "../config";
+import { wsLocation } from "../config";
 
 // types
-import { Options, Proposals } from "./types";
+import { Proposals } from "./types";
 import { types } from "@joystream/types";
-import { CategoryId } from "@joystream/types/forum";
 import { ApiPromise, WsProvider } from "@polkadot/api";
 import { Header } from "@polkadot/types/interfaces";
 
@@ -75,7 +74,7 @@ const main = async () => {
       log("first thread");
       announce.threads(api, threads, sendMessage);
 
-      log("last threadl");
+      log("last thread");
       threads[1] = await get.currentThreadId(api);
       threads[0] = threads[1] - 1;
       announce.threads(api, threads, sendMessage);