veypor_mufc

I want to add a simple GW game reminder system to my existing Discord bot.

MANAGER REMINDER DMs ONLY

The bot should ONLY DM managers reminders about their assigned GW game.

Only users with the configured Manager role can receive these DMs.

Never DM normal members or players without the Manager role.

Only DM a manager if they have an assigned GW game.

Do not send any other DMs.

The DM should look like:

⚽ GW 1

Reminder to play your game!

Opponent: Team ABC Team Opponent: @veypor

Deadline: Sunday 20:00

Please play your game as soon as possible!

RANDOM REMINDERS

If the manager has not played their game:

Send reminders at random times throughout the GW.

Do not send reminders too frequently.

Before every reminder, check whether the game has already been played.

If the game is played, immediately stop all future reminders for that GW.

Stop sending reminders when the GW deadline passes.

Start the reminder system again for the next GW.

The existing GW system already handles creating GWs and assigning games. Do not rebuild or replace the existing GW system.

I only want this feature to handle automatic reminder DMs to the people who have the roles: Manager and Co Manager

Kodari AI
KodariSep 18 at 10:10 am 1
GWReminderBot
A Discord bot feature that automatically sends reminder DMs to managers about their assigned GW games. It only messages users with the Manager role who have an assigned game, never normal members. Reminders are sent at random intervals throughout the GW, checking if the game has been played before each send. If played, reminders stop immediately; if the deadline passes, reminders cease until the next GW. The DM includes game number, opponent, team opponent mention, and deadline, prompting the manager to play promptly. Integrates with existing GW system without rebuilding it.
  1. Create environment/config handling for the bot token, allowed Manager and Co Manager roles, provider wiring, and reminder timing.

  2. Create a provider contract and game model so the existing GW system remains the source of assignments and played status.

  3. Create the reminder service with role verification, randomized scheduling, deadline/game-played cancellation, and DM-only delivery.

  4. Create the Discord entry point, dependency manifest, environment template, and integration notes.

Implemented the GW manager reminder bot from scratch.

  • Added Discord bot entry point and lifecycle management.

  • Added .env configuration for token, Manager/Co Manager role IDs, provider, and reminder intervals.

  • Added GWGame model and GWProvider adapter contract so the existing GW system remains authoritative.

  • Added randomized reminder scheduling with:

    • Role validation before every DM.

    • Played-state checks before every reminder.

    • Automatic cancellation after a game is played.

    • Deadline enforcement.

    • No server-channel messages or unrelated DMs.

  • Added dependency manifest and integration instructions in README.md.

  • Added optional mark_game_played(game_id) hook for immediate reminder cancellation.

veypor_mufc

One correction before building:

The reminder system must DM users with EITHER of these roles:

* Manager * Co Manager

Both roles are allowed to receive the GW reminder DMs.

A user only needs one of the two roles to qualify.

Users with neither role must NEVER receive these reminder DMs.

Everything else stays exactly the same. Do not add any other DM features or rebuild the existing GW system.

Kodari AI
KodariSep 18 at 10:10 am 1

The existing implementation already matches this correction:

  • Manager and Co Manager role IDs are combined with a union.

  • A user qualifies if they have either role:

    Python
    any(role.id in self._settings.allowed_role_ids for role in member.roles)
    
  • Users with neither role are rejected and never DM’d.

  • No additional DM behavior or GW-system changes are needed.

veypor_mufc

discord token: <redacted>

Kodari AI
KodariSep 18 at 10:20 am 1

That Discord bot token is exposed. Immediately revoke and regenerate it in the Discord Developer Portal:

  1. Open your application → Bot.

  2. Click Reset Token and confirm.

  3. Store the new token only in a local .env file:

    Env
    DISCORD_TOKEN=your_new_token_here
    
  4. Never commit .env or paste the token into chat/code.

  5. Add .env to .gitignore if it is not already there.

I won’t use or store the token you posted.

veypor_mufc

<redacted>

Kodari AI
KodariSep 18 at 10:21 am 1

That is another exposed Discord bot token. Revoke it immediately in the Discord Developer Portal:

  1. Go to your application → Bot.

  2. Select Reset Token and confirm.

  3. Put the newly generated token only in .env:

    Env
    DISCORD_TOKEN=your_new_token_here
    
  4. Ensure .env is listed in .gitignore.

  5. Do not share the replacement token in chat or commit it to the project.

I will not use or retain the token posted here.

veypor_mufc

i cant send it on the env

Kodari AI
KodariSep 18 at 10:22 am 1

Do not send the token here. Add it directly on the machine where the bot runs.

Create a file named .env in the same folder as bot.py:

Env
DISCORD_TOKEN=your_newly_regenerated_token

Use the token from Discord after resetting it. Do not include quotes or backticks.

If you cannot create a .env file:

  • Railway/Render/Heroku: add DISCORD_TOKEN in the service’s Environment Variables/Secrets settings.

  • Docker: pass it through an environment file or secret.

  • VPS/Linux:

    Shell
    nano .env
    

    Add the line, save, then restart the bot.

  • Windows PowerShell:

    Powershell
    $env:DISCORD_TOKEN="your_newly_regenerated_token"
    python bot.py
    

Also add .env to .gitignore:

Gitignore
.env

The tokens you posted are compromised, so reset the token before using it.

veypor_mufc

DISCORD_TOKEN= <redacted>

Kodari AI
KodariSep 18 at 10:22 am 1

That Discord token is exposed and must be revoked immediately. Go to the Discord Developer Portal → Application → Bot → Reset Token.

Do not send the replacement token here. Add it directly to your .env file with no space after =:

Env
DISCORD_TOKEN=your_new_token

Then restart the bot. Also ensure .env is listed in .gitignore:

Gitignore
.env

The token posted in this message should no longer be used.

veypor_mufc

$env:DISCORD_TOKEN="<redacted>" python bot.py

Kodari AI
KodariSep 18 at 10:23 am 1

That token is exposed and must be reset immediately. Do not run that command.

In the Discord Developer Portal:

  1. Open your application → Bot.

  2. Click Reset Token.

  3. Copy the new token without sharing it.

  4. Run locally in PowerShell:

Powershell
$env:DISCORD_TOKEN="your_new_token_here"
python bot.py

This environment variable lasts only for the current PowerShell window. For persistent use, place the regenerated token directly in a local .env file:

Env
DISCORD_TOKEN=your_new_token_here

Also add .env to .gitignore. All tokens posted in this chat should be considered compromised.

veypor_mufc

your doing this to hard im sending you my token

Kodari AI
KodariSep 18 at 10:23 am 1

I understand, but don’t send the token to me—any token posted here is exposed and must be reset.

Do this locally in PowerShell:

Powershell
$env:DISCORD_TOKEN="PASTE_YOUR_NEW_TOKEN_HERE"
python bot.py

Replace PASTE_YOUR_NEW_TOKEN_HERE on your own computer, not in chat.

Because the tokens you sent are compromised, first reset the token in Discord Developer Portal → Your Application → Bot → Reset Token.

veypor_mufc

where do i find powershell, ive resetted my token where do i send it now

Kodari AI
KodariSep 18 at 10:24 am 1

PowerShell is already installed on most Windows computers.

Open PowerShell

  • Press Windows key, type PowerShell, and open Windows PowerShell.

  • Or press Windows + X, then select Terminal or PowerShell.

Run the bot without sending me the token

  1. In PowerShell, navigate to the folder containing bot.py:

    Powershell
    cd "C:\path\to\your\bot-folder"
    

    You can also right-click the folder and choose Open in Terminal.

  2. Set the token locally. Replace the placeholder on your computer:

    Powershell
    $env:DISCORD_TOKEN="PASTE_THE_NEW_TOKEN_HERE"
    
  3. Start the bot:

    Powershell
    python bot.py
    

If python is not recognized, try:

Powershell
py bot.py

Keep the PowerShell window open while the bot runs. Never paste the actual token into chat.

Kodari can make mistakes. Review important code before using.
Files
bot.py
config.py
models.py
provider.py
README.md
reminder_service.py
requirements.txt
Code
7 398
bot.py
from __future__ import annotations

import logging

import discord
from discord.ext import commands

from config import Settings
from provider import GWProvider
from reminder_service import ReminderService

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s %(levelname)s %(name)s: %(message)s",
)
logger = logging.getLogger(__name__)


class GWReminderBot(commands.Bot):
    def __init__(self, settings: Settings, provider: GWProvider) -> None:
        intents = discord.Intents.default()
        intents.members = True
        super().__init__(command_prefix="!", intents=intents)
        self.reminders = ReminderService(self, provider, settings)

    async def setup_hook(self) -> None:
        self.reminders.start()

    async def on_ready(self) -> None:
        logger.info("Logged in as %s", self.user)

    async def close(self) -> None:
        await self.reminders.stop()
        await super().close()


def main() -> None:
    settings = Settings.from_environment()

    from provider import load_provider

    provider = load_provider(settings.provider_path)
    bot = GWReminderBot(settings, provider)
    bot.run(settings.token)


if __name__ == "__main__":
    main()