friedrich-de / TMW_Bot

GNU General Public License v3.0
2 stars 5 forks source link

Deploy Discord Bot

TheMoeWay Discord Bot

Multi-purpose Discord bot developed for the TMW Discord server. The bot is designed to be modular and easy to extend with new features.

Features/Commands

auto_receive.py

Lets admins set roles which automatically get assigned another role. For example, if a user has 'Eternal Idol' role they get the 'Custom Role' role, which gives more permissions like creating custom roles.

Commands:

All commands here require administrator permissions by default.


bookmark.py

Lets users bookmark messages by reacting with 🔖. Bookmarked messages are sent to the user's DMs and can be removed with ❌. Also tracks most bookmarked messages per server.

Commands:

User Actions:


custom_role.py

Lets users create and manage their own custom roles with custom colors and icons (if the server has enough boosts). Custom roles are positioned below a reference role and are automatically removed if the user loses the required permissions.

Commands:

Note: Users need one of the allowed roles (set by admin) to create and keep custom roles.


dumb_db.py

Simple command that allows users to download a compressed copy of the bot's database file.

Commands:


event_roles.py

Automatically creates and manages roles for Discord scheduled events. When an event is created, a corresponding role is made and assigned to participants. The role is automatically deleted when the event ends.

No user commands - fully automatic.


gatekeeper.py

Works with Kotoba bot quizzes to verify and award roles based on quiz performance.

Commands:

Note: Requires configuration in gatekeeper_settings.yml to define quiz requirements and role structure.


immersion_log.py, immersion_goals.py, immersion_stats.py

Comprehensive immersion tracking system that allows users to log their Japanese learning activities, set goals, and view statistics.

Commands:

Goal Management:

Statistics:


immersion_bar_races.py

Creates a racing bar chart of immersion logs for a specified time perid which visualizes how much users logged over time and who is in the lead.

Commands:


info.py

Provides informational commands that display predefined knowledge and documentation to users. Commands and their content are configured through a YAML file.

Commands:

Note: Requires configuration in config/info_commands.yml to define available topics and their content.


kneels.py

Tracks and displays statistics for "kneeling" reactions on messages. Users can react with 🧎, 🧎‍♂️, 🧎‍♀️ or custom emojis containing "ikneel" to "kneel".

Commands:

User Actions:


rank_saver.py

Automatically saves and restores user roles when they leave and rejoin the server. Runs every 10 minutes to save current roles and restores applicable roles when a user rejoins.

Note: Requires configuration in rank_saver_settings.yml to define ignored roles and announcement channels. No user commands - fully automatic.


selfmute.py

Allows users to temporarily mute themselves for a specified duration. Users can choose from multiple mute roles and their existing roles are automatically restored when the mute expires.

Commands:

Note: Requires configuration in selfmute_settings.yml to define mute roles and announcement channels.


sticky_messages.py

Allows moderators to make messages "sticky" in channels, meaning they will reappear after new messages, making the message always visible at the bottom of the channel.

Commands:


sync.py

Manages command synchronization between the bot and Discord's command system. For authorized users only.

Commands (used with prefix):

Note: All commands require the user to be listed in the AUTHORIZED_USERS environment variable.


thread_resolver.py

Manages help threads in forum channels by tracking solved status and prompting for updates on inactive threads.

Commands:

Note: Requires configuration in thread_resolver_settings.yml to define help forum channels.


username_fetcher.py

Internal utility module that maintains a database of user IDs and usernames. Used by other modules to efficiently fetch and cache usernames.

Note: No user commands - internal utility module only.

How to contribute

  1. Report bugs and suggest features in the issues tab.

  2. Create a PR with your changes. The bot is made to run server indepedently, so you can run it anywhere you want to test your changes.

How to run

  1. Clone the repository

  2. Create a virtual environment and install the requirements with pip install -r requirements.txt

  3. Create a .env file in the root directory and add the following variables:

    TOKEN=YOUR_DISCORD_BOT_TOKEN

    AUTHORIZED_USERS=960526101833191435,501009840437592074 Comma separated list of user IDs who can use bot management commands.

    DEBUG_USER=960526101833191435 User ID of the user who gets sent debug messages.

    COMMAND_PREFIX=%

    PATH_TO_DB=data/db.sqlite3

    TMDB_API_KEY=YOUR_TMDB_API_KEY

  4. Run the bot with python main.py

Overwrite Settings

You can link to alternative setting files by setting the path in the corresponding environment variable.

Each part of the bot can be configured separately. Please look into the cog files for the variable names.

Acknowledgements

This bot is based on the following project (mostly used as a feature reference without or minimal direct code reuse):