Add emojis to all Telegram bot messages and menus#12
Conversation
…t management Transform Polybot from single-user CLI to multi-user Telegram bot: - SQLite database for multi-user storage with encrypted private keys (AES-256-GCM) - Interactive inline keyboard menus for wallet, settings, trading, and position management - Per-user bot instances with independent trade monitoring and execution - Full settings management via Telegram (slippage, risk, filters, sizing, keywords) - Wallet connection flow with support for EOA, Email, and Browser wallet types - Follow/unfollow traders with per-trader allocation percentages - Position viewing, individual sell, and sell-all functionality - Run with: npm run telegram https://claude.ai/code/session_012j2JT3oXieZBydkazQxYSY
Enhance the visual appearance of all Telegram messages by adding contextual emojis throughout menus, notifications, and status messages including settings buttons, position details, trade notifications, stats labels, follow/wallet flows, and command help text. https://claude.ai/code/session_01WCuqjynVrtHj3DbKWXmhBz
| import { TradeMonitor } from './tradeMonitor.js'; | ||
| import { PositionSizer } from './positionSizer.js'; | ||
| import { OrderQueue, QueuedOrder } from './orderQueue.js'; | ||
| import { RiskManager } from './riskManager.js'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
In general, unused imports should be removed to keep the codebase clean and avoid confusion. If the module’s side effects are needed but the binding is not, the import should be converted to a side-effect-only import (import './riskManager.js';).
For this specific case, the best minimal fix that does not change existing functionality is to delete the unused RiskManager named import from src/services/userBotManager.ts. Since the rest of the file (in the provided snippet) does not reference RiskManager, and other imports already provide the needed types and classes, removing this one line will not alter runtime behavior or type-checking, it will only remove the dead import. No new methods, fields, or definitions are necessary, and no other lines in this file need adjusting.
| @@ -1,7 +1,6 @@ | ||
| import { TradeMonitor } from './tradeMonitor.js'; | ||
| import { PositionSizer } from './positionSizer.js'; | ||
| import { OrderQueue, QueuedOrder } from './orderQueue.js'; | ||
| import { RiskManager } from './riskManager.js'; | ||
| import { Trader, TradeResult } from './trader.js'; | ||
| import { ClobApiClient } from '../api/clobApi.js'; | ||
| import { isMarketBlacklisted, isMarketWhitelisted } from './tradeFilter.js'; |
| import { OrderQueue, QueuedOrder } from './orderQueue.js'; | ||
| import { RiskManager } from './riskManager.js'; | ||
| import { Trader, TradeResult } from './trader.js'; | ||
| import { ClobApiClient } from '../api/clobApi.js'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
In general, unused imports should be removed to keep the codebase clean and avoid misleading future readers about dependencies. Since ClobApiClient is not referenced anywhere in src/services/userBotManager.ts, the safest and most direct fix that preserves behavior is to delete the unused import line.
Concretely, in src/services/userBotManager.ts, remove line 6:
import { ClobApiClient } from '../api/clobApi.js';No other changes are needed: we do not need to add any new imports, change the constructor, or modify any methods, because nothing in this file relies on ClobApiClient at present.
| @@ -3,7 +3,6 @@ | ||
| import { OrderQueue, QueuedOrder } from './orderQueue.js'; | ||
| import { RiskManager } from './riskManager.js'; | ||
| import { Trader, TradeResult } from './trader.js'; | ||
| import { ClobApiClient } from '../api/clobApi.js'; | ||
| import { isMarketBlacklisted, isMarketWhitelisted } from './tradeFilter.js'; | ||
| import { UserDb, UserSettings } from '../db/userDb.js'; | ||
| import { TradeSignal, WalletConfig, CopyConfig } from '../types/index.js'; |
| import { ClobApiClient } from '../api/clobApi.js'; | ||
| import { isMarketBlacklisted, isMarketWhitelisted } from './tradeFilter.js'; | ||
| import { UserDb, UserSettings } from '../db/userDb.js'; | ||
| import { TradeSignal, WalletConfig, CopyConfig } from '../types/index.js'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
In general, unused imports should be removed from the file where they are declared. This improves readability, avoids misleading future maintainers into thinking a type or value is relevant there, and can slightly improve tooling performance.
For this specific case in src/services/userBotManager.ts, the best fix is to keep the import of actually used types (TradeSignal, WalletConfig) and remove only CopyConfig from the destructuring import. No other code changes are necessary, and there is no functional impact because removing an unused import does not affect runtime behavior.
Concretely:
- Edit
src/services/userBotManager.ts. - Locate the line:
import { TradeSignal, WalletConfig, CopyConfig } from '../types/index.js';
- Replace it with:
import { TradeSignal, WalletConfig } from '../types/index.js';
No additional methods, imports, or definitions are needed.
| @@ -6,7 +6,7 @@ | ||
| import { ClobApiClient } from '../api/clobApi.js'; | ||
| import { isMarketBlacklisted, isMarketWhitelisted } from './tradeFilter.js'; | ||
| import { UserDb, UserSettings } from '../db/userDb.js'; | ||
| import { TradeSignal, WalletConfig, CopyConfig } from '../types/index.js'; | ||
| import { TradeSignal, WalletConfig } from '../types/index.js'; | ||
| import TelegramBot from 'node-telegram-bot-api'; | ||
|
|
||
| export interface UserBotInstance { |
| @@ -0,0 +1,197 @@ | |||
| import TelegramBot from 'node-telegram-bot-api'; | |||
| import { UserDb } from '../../db/userDb.js'; | |||
| import { positionsMenu, confirmMenu, backButton } from '../menus.js'; | |||
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix an unused import, remove it from the import list so that only actually used symbols are imported. This preserves functionality while improving readability and avoiding linter/static-analysis noise.
Concretely, in src/telegram/handlers/positions.ts, on the import line from ../menus.js, remove backButton from the destructuring import while keeping positionsMenu and confirmMenu unchanged. No additional imports, methods, or definitions are required; we are only narrowing the existing import.
| @@ -1,6 +1,6 @@ | ||
| import TelegramBot from 'node-telegram-bot-api'; | ||
| import { UserDb } from '../../db/userDb.js'; | ||
| import { positionsMenu, confirmMenu, backButton } from '../menus.js'; | ||
| import { positionsMenu, confirmMenu } from '../menus.js'; | ||
| import type { UserBotManager } from '../../services/userBotManager.js'; | ||
|
|
||
| export function registerPositionsHandler(bot: TelegramBot, db: UserDb, getBotManager: () => UserBotManager): void { |
| @@ -0,0 +1,68 @@ | |||
| import TelegramBot from 'node-telegram-bot-api'; | |||
| import { UserDb } from '../../db/userDb.js'; | |||
| import { backButton } from '../menus.js'; | |||
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the problem, remove the unused import of backButton from ../menus.js. This eliminates dead code, avoids confusion, and has no effect on runtime behavior since backButton is never referenced.
Concretely, in src/telegram/handlers/stats.ts, delete line 3 that imports backButton. No other code changes are needed, and no additional methods, imports, or definitions are required.
| @@ -1,6 +1,5 @@ | ||
| import TelegramBot from 'node-telegram-bot-api'; | ||
| import { UserDb } from '../../db/userDb.js'; | ||
| import { backButton } from '../menus.js'; | ||
|
|
||
| export function registerStatsHandler(bot: TelegramBot, db: UserDb): void { | ||
|
|
| @@ -0,0 +1,96 @@ | |||
| import TelegramBot from 'node-telegram-bot-api'; | |||
| import { UserDb } from '../../db/userDb.js'; | |||
| import { tradingMenu, backButton } from '../menus.js'; | |||
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the problem, remove the unused backButton named import from the import statement so only the actually used tradingMenu symbol is imported. This eliminates the unused import without changing any existing functionality.
Concretely, in src/telegram/handlers/trading.ts, on the import line currently reading import { tradingMenu, backButton } from '../menus.js';, remove backButton and its trailing comma/space. The resulting line should be import { tradingMenu } from '../menus.js';. No other code changes are needed, and no additional imports or definitions are required.
| @@ -1,6 +1,6 @@ | ||
| import TelegramBot from 'node-telegram-bot-api'; | ||
| import { UserDb } from '../../db/userDb.js'; | ||
| import { tradingMenu, backButton } from '../menus.js'; | ||
| import { tradingMenu } from '../menus.js'; | ||
| import type { UserBotManager } from '../../services/userBotManager.js'; | ||
|
|
||
| export function registerTradingHandler(bot: TelegramBot, db: UserDb, getBotManager: () => UserBotManager): void { |
Summary
Test plan
https://claude.ai/code/session_01WCuqjynVrtHj3DbKWXmhBz