Complete integration between Arsenal Lab's Telegram bot and GitHub ecosystem.
The Telegram bot now provides live access to:
- GitHub Repository Metrics - Stars, forks, issues, watchers
- Wiki Search - Full-text search across wiki pages
- GitHub Discussions - Latest community discussions
- GitHub Pages Deployment - Live deployment status
- Auto-Published Metrics - Bot metrics updated every 10 minutes
Shows live statistics from the Arsenal Lab repository:
/metrics
Features:
- ⭐ Star count
- 🍴 Fork count
- 🐛 Open issues
- 👀 Watchers
- 💻 Primary language
- 📦 Repository size
- 🕒 Last updated timestamp
- Links to repository and live site
Rate Limits:
- Without token: 60 requests/hour
- With token: 5000 requests/hour
Search Arsenal Lab wiki for documentation:
/wiki home
/wiki performance
/wiki getting started
Features:
- Exact title matching
- Full-text content search
- Top 5 results with summaries
- Direct links to wiki pages
- 10-minute cache for performance
How it works:
- Clones wiki repository to temp directory
- Parses all
.mdfiles - Searches titles and content
- Returns matching pages with summaries
View the 5 most recent GitHub Discussions:
/discuss
Features:
- Discussion titles and authors
- Category badges
- Upvote counts
- Comment counts
- Answered status
- Relative timestamps ("2 hours ago")
- Direct links to discussions
Check GitHub Pages deployment status:
/deploy
Features:
- Deployment status (Live, Building, Failed)
- Last updated timestamp
- Build time (if available)
- Direct link to live site
Statuses:
- ✅ Live - Site is deployed and accessible
- ⏳ Building - Deployment in progress
- 🔄 Queued - Waiting to build
- ❌ Failed - Deployment error
-
Go to GitHub Settings → Developer settings → Personal access tokens
-
Click "Generate new token (classic)"
-
Set expiration and permissions:
repo- Full repository accessread:org- Read organization data (for discussions)read:user- Read user profile
-
Copy the token (starts with
ghp_)
# Add to .env file
echo "GITHUB_TOKEN=ghp_your_token_here" >> .envSecurity Notes:
- Never commit
.envto version control - Rotate tokens every 90 days
- Use fine-grained tokens when possible
- Monitor token usage in GitHub settings
The bot automatically publishes metrics to GitHub Pages every 10 minutes:
File: .github/workflows/publish-metrics.yml
name: Publish Bot Metrics
on:
schedule:
- cron: '*/10 * * * *' # Every 10 minutes
workflow_dispatch: # Manual triggerPublished to: https://brendadeeznuts1111.github.io/Arsenal-Lab/metrics/metrics.json
{
"commandsProcessed": 1247,
"uniqueUsers": 42,
"averageResponseTime": 125,
"errorsEncountered": 3,
"lastUpdated": "2025-10-22T03:26:55.000Z",
"uptime": 86400,
"version": "1.0.0",
"runtimeInfo": {
"bunVersion": "1.3.0",
"platform": "linux",
"architecture": "x64"
}
}# Export metrics locally
bun run scripts/export-metrics.ts
# Metrics saved to: metrics/metrics.jsonAdd live bot metrics to your React app:
import { TelegramBotMetrics } from './components/TelegramBotMetrics';
function App() {
return (
<div>
<TelegramBotMetrics />
</div>
);
}Features:
- Auto-refreshes every 30 seconds
- Live indicator with pulse animation
- Responsive grid layout
- Error handling and loading states
- Links to bot, group, and channel
| Auth Type | Limit | Reset Time |
|---|---|---|
| No token | 60/hour | Every hour |
| With token | 5000/hour | Every hour |
| GraphQL | 5000 points/hour | Every hour |
- Duration: 10 minutes
- Strategy: Clone on first request, update on cache miss
- Storage: Temporary directory (
/tmp/arsenal-lab-wiki) - Clear cache: Restart bot or wait 10 minutes
- Duration: 10 minutes (GitHub Actions)
- Format: JSON
- Location:
metrics/metrics.jsonin gh-pages branch
All GitHub commands handle common errors gracefully:
❌ GitHub API Rate Limit Exceeded
The API rate limit has been reached. Please try again later.
Tip: Add a GitHub token to increase the rate limit from 60 to 5000 requests per hour.
❌ Wiki Search Failed
Failed to clone wiki: repository not found
The wiki repository may not be available. Try again later.
❌ GitHub Discussions Unavailable
Discussions may not be enabled for this repository, or a GitHub token is required.
🔗 Visit Discussions
🚀 GitHub Pages Deployment
✅ Assumed Live
Deployment details unavailable via API, but the site should be live.
🌐 Visit Live Site
# Start bot
bun run telegram:dev
# Test in Telegram:
/metrics
/wiki home
/discuss
/deploy# Generate metrics
bun run scripts/export-metrics.ts
# Check output
cat metrics/metrics.json# Trigger manually
gh workflow run publish-metrics.yml
# Check status
gh run list --workflow=publish-metrics.ymlCause: Wiki repository might not exist or is empty
Fix:
- Create wiki on GitHub
- Add at least one page (Home.md)
- Try command again (cache will clear in 10 minutes)
Cause: GitHub Actions workflow not running
Fix:
- Check workflow is enabled: Settings → Actions
- Verify
GITHUB_TOKENhascontents: writepermission - Check workflow runs: Actions → Publish Bot Metrics
Cause: No GitHub token or token expired
Fix:
- Generate new token (see above)
- Add to
.envfile - Restart bot
Cause: GitHub API slow or unreachable
Fix:
- Check GitHub status: https://www.githubstatus.com/
- Increase timeout in bot configuration
- Try again later
Update src/integrations/github/wiki.ts:
const WIKI_REPO = 'https://github.com/your-org/your-repo.wiki.git';Edit .github/workflows/publish-metrics.yml:
schedule:
- cron: '*/5 * * * *' # Every 5 minutesExtend scripts/export-metrics.ts:
function generateMetrics(): BotMetrics {
return {
// ... existing metrics
customMetric: calculateCustomMetric(),
};
}- GitHub REST API: https://docs.github.com/rest
- GitHub GraphQL API: https://docs.github.com/graphql
- GitHub Pages: https://docs.github.com/pages
- Personal Access Tokens: https://github.com/settings/tokens
- Rate Limits: https://docs.github.com/rest/overview/rate-limits-for-the-rest-api
✅ 4 new commands: /metrics, /wiki, /discuss, /deploy
✅ GitHub API integration with proper auth and rate limiting
✅ Wiki search with full-text indexing and caching
✅ Auto-published metrics every 10 minutes via GitHub Actions
✅ React component for live metrics display on GitHub Pages
✅ Production-ready error handling and fallbacks
All code is production-ready with comprehensive error handling, caching, and security best practices.