Skip to content

Cacus3/Tangia-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tangia Bot

A Twitch chat bot designed to automatically join Tangia Dungeons and Boss Fights, with additional features for streamers and moderators.

Features

  • Auto-Join: Automatically joins Tangia Dungeons and Boss Fights when detected in chat.
  • Channel-Specific Control: Supports multiple channels with independent configurations.
  • Pause Functionality: Allows authorized users to pause the bot for a specified duration.
  • Customizable Permissions: Define which users can control the bot on each channel.
  • Customizable Messages: Customize the bot's messages for different events, commands, and responses to fit the needs of each community.
  • Custom Commands: Allow the creation of custom commands tailored to the channel’s needs
  • Token Refresh: Automatically refreshes Twitch OAuth tokens when expired.
  • Logging: Detailed logging with timestamps and color-coded messages.

Installation

Prerequisites

  • Node.js (v18 or higher)
  • npm (included with Node.js)
  • Docker (optional, for containerized deployment)

Steps

  1. Clone the repository:

    git clone https://github.com/Cacus3/tangia-bot.git
    cd tangia-bot
  2. Install dependencies:

    npm install
  3. Create a .env file based on .env.example and fill in the required values:

    cp .env.example .env
  4. Start the bot:

    npm start

Docker Deployment

  1. Build the Docker image:

    docker-compose build
  2. Start the container:

    docker-compose up -d
  3. View logs:

    docker-compose logs -f

Configuration

Environment Variables

Variable Description
TWITCH_CLIENT_ID Your Twitch application client ID.
TWITCH_CLIENT_SECRET Your Twitch application client secret.
BOT_USERNAME The username of your Twitch bot account.
CHANNELS Comma-separated list of channels to join (e.g., "channel1,channel2").
INITIAL_ACCESS_TOKEN Initial OAuth access token for the bot.
INITIAL_REFRESH_TOKEN Initial OAuth refresh token for the bot.
ALLOWED_USERS JSON object mapping channels to allowed users for moderate bot (e.g., {"channel1":["user1"]}).
STOP_DURATIONS JSON object mapping channels to stop durations in minutes (e.g., {"channel1":30}).
RESPONSE_DELAY_MIN Minimum delay in milliseconds between each response.
RESPONSE_DELAY_MAX Maximum delay in milliseconds between each response.
PAUSE_COMMANDS JSON object mapping channels to pause commands (e.g., {"channel1":["!pausebot", "!stoptangiabot"]}).
ENABLE_PAUSE_MESSAGES Set to true to enable showing pause messages when bot is paused.
ENABLE_MISSING_PERMISSION_MESSAGES Set to true to enable showing missing permission messages.
ENABLE_RESUME_MESSAGES Set to true to enable showing resume messages when the bot is resumed.
PAUSE_MESSAGE Message to display when bot is paused, uses placeholders {username}, {duration}, and {channel}.
RESUME_MESSAGE Message to display when bot is resumed, uses placeholders {username} and {channel}.
MISSING_PERMISSION_MESSAGE Message to display when a user lacks permission, uses placeholder {username}.

Usage

Commands

  • Auto-Join: The bot automatically joins Dungeons and Boss Fights when detected in chat.
  • !stopTangiaBot: Pauses the bot for a specified duration (only for authorized users).

Example Scenarios

  1. Auto-Join:

    • When tangiabot posts: Player123 started a Tangia Dungeon! Use !join to join the party.
    • The bot responds with: !join
  2. Pause Bot:

    • An authorized user types: !stoptangiabot
    • The bot responds: ⏸️ Bot paused for {duration} minutes!
    • After the duration, the bot resumes: ▶️ Bot active!

Project Structure

tangia-bot/
├── src/
│   ├── config/            # Configuration files
│   ├── services/          # Core bot functionality
│   ├── utils/             # Utility functions (e.g., logging)
│   └── index.js           # Main entry point
├── .env.example           # Example environment variables
├── docker-compose.yml     # Docker Compose configuration
├── Dockerfile             # Dockerfile for containerization
├── package.json           # Node.js dependencies and scripts
└── README.md              # This file

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Submit a pull request with a detailed description of your changes.

License

This project is licensed under the MPL 2.0 License.

Support

For issues or questions, please open an issue on the GitHub repository.


Happy streaming! 🎮

About

A bot for twitch game called Tangia

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors