A Discord trivia bot that challenges players to identify artists behind NFTs from The Tezos Community (TTC) wallet. The game fetches real NFT data from objkt.com and runs timed, multi-round competitions with scoring based on speed and accuracy.
- ๐ฎ Multi-round gameplay - 10 rounds per game with timed responses
- ๐ผ๏ธ Real NFT data - Fetches from TTC wallet via objkt.com GraphQL API
- ๐ Button-based UI - Multiple choice answers (A/B/C/D)
- โฑ๏ธ Speed-based scoring - Faster answers earn more points
- ๐ Persistent leaderboard - Track top players across games
- ๐ Comprehensive statistics - Track wins, accuracy, correct/incorrect answers
- ๐ฏ All-time leaderboards - Multiple sorting options for different achievements
- ๐พ Token caching - Automatic refresh every 24 hours
- ๐ฟ Progressive storage - Append-only logs for durability and crash recovery
- ๐จ TTC branding - Tezos community themed throughout
- โก Built for Node.js - Discord.js v14 with ES6 modules
- ๐ก๏ธ Anti-spam protection - Command cooldowns prevent abuse
- ๐ฎ Admin controls - Moderators can bypass cooldowns and manage games
- Node.js 18.x or higher (or Bun)
- A Discord Bot Token (Create one here)
- Clone the repository:
git clone https://github.com/skullzarmy/Name-That-Artist.git
cd Name-That-Artist- Install dependencies:
npm install- Create a
.envfile from the example:
cp .env.example .env- Edit
.envand add your Discord bot credentials:
DISCORD_TOKEN=your_discord_bot_token_here
CLIENT_ID=your_client_id_here- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section:
- Click "Add Bot"
- Copy the Token (this is your
DISCORD_TOKEN) - Enable "Message Content Intent" under Privileged Gateway Intents
- Go to "OAuth2" โ "General":
- Copy the Application ID (this is your
CLIENT_ID)
- Copy the Application ID (this is your
- Invite the bot to your server:
- Go to OAuth2 โ URL Generator
- Select scopes:
bot,applications.commands - Select permissions:
Send Messages,Embed Links,Read Messages/View Channels - Copy and open the generated URL
Register slash commands with Discord:
npm run deploy-commandsnpm startOr for development (auto-restart on changes):
npm run dev/namethatartist- Start a new game (10 rounds of trivia)/leaderboard- View top players by total score/alltime [sort]- View all-time leaderboards with various sorting options:- Total Score (default)
- Total Wins
- Average Score
- Best Score
- Accuracy Rate
- Games Played
- Correct Answers
/stats- View your personal game statistics/stopgame- Stop the current game (starter or moderator only)/ping- Check if the bot is responsive/help- Get help and information about the game
The bot includes built-in protection against spam and abuse:
Commands have cooldowns to prevent spam:
- Game Start (
/namethatartist): 30 seconds per user, 5 seconds per channel - Leaderboard (
/leaderboard): 10 seconds per user - All-Time Stats (
/alltime): 10 seconds per user - Stats (
/stats): 5 seconds per user - Stop Game (
/stopgame): 3 seconds per user - Help (
/help): 10 seconds per user - Ping (
/ping): 5 seconds per user
Users with Administrator or Manage Messages permissions can:
- Bypass all command cooldowns
- Stop any active game in their channels
- Help moderate game sessions
Cooldown settings can be customized in config.js under the cooldowns section.
Name-That-Artist/
โโโ index.js # Main bot entry point with Discord handlers
โโโ game.js # Multi-round game logic and session management
โโโ config.js # Configuration and game settings
โโโ deploy-commands.js # Slash command registration
โโโ services/
โ โโโ objkt-api.js # objkt.com GraphQL API integration
โ โโโ storage.js # Local JSON storage for data persistence
โ โโโ cooldown.js # Command cooldown and anti-spam management
โโโ data/ # Auto-generated data files (gitignored)
โ โโโ tokens.json # Cached NFT tokens
โ โโโ players.json # Player statistics
โ โโโ game_state.json # Active game sessions
โโโ package.json # Project dependencies
โโโ .env.example # Example environment variables
โโโ README.md # This file
- Discord.js v14 - Discord API wrapper with button interactions
- graphql-request - objkt.com GraphQL API client
- Node.js - JavaScript runtime (ES6 modules)
- dotenv - Environment variable management
- Local JSON storage - Persistent data without database
- Compatible with Bun runtime
This bot is created for The Tezos Community (TTC), celebrating the vibrant art scene on the Tezos blockchain. The game fetches NFTs from the TTC community wallet (tz1RZN17j7FuPtDpGpXKgMXbx57WEhpZGF6B) and helps members discover and appreciate the talented artists in the ecosystem.
- Initialization: Bot fetches NFT tokens from the TTC wallet via objkt.com GraphQL API
- Token Caching: Stores tokens locally for 24 hours to reduce API calls
- Game Start: Player initiates a game with
/namethatartist - Rounds: Each game has 10 rounds with random NFTs
- Multiple Choice: Each round shows 4 artist options (1 correct, 3 distractors)
- Timed Answers: Players have 15 seconds to click the correct button
- Scoring: Points = 100 ร (time_remaining / total_time)
- Leaderboard: Scores are saved and tracked across games
The bot tracks comprehensive player statistics across all games:
- Total Games Played - How many games you've participated in
- Total Wins - Number of games won (highest score)
- Total Score - Cumulative points across all games
- Average Score - Mean score per game
- Best Score - Your personal high score
- Correct Answers - Total number of correct answers across all games
- Incorrect Answers - Total number of wrong answers
- Accuracy Rate - Percentage of correct answers
Use /alltime with different sorting options to see who leads in:
- ๐ Total Score - Most points accumulated (default)
- ๐ Total Wins - Most games won
- ๐ Average Score - Highest average performance
- โญ Best Score - Highest single-game score
- ๐ฏ Accuracy Rate - Best answer accuracy
- ๐ฎ Games Played - Most active players
- โ Correct Answers - Most questions answered correctly
All statistics are stored using a progressive flat-file system with append-only logs for durability and crash recovery.
If you have Bun installed:
bun install
bun run index.js- Add command definition in
deploy-commands.js - Add command handler in
index.jsunder theInteractionCreateevent - Run
npm run deploy-commandsto register the new command
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
- Progressive Storage System - Details about the append-only log system for durability
- Setup Guide - Detailed setup instructions
- Game Guide - How to play the game
- Contributing Guide - How to contribute to the project
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โค๏ธ for The Tezos Community