<a class="avatar-status"…
- User
cabn you get it from the avatar status from my profile and if it equals to the game id it sends the notification this is for roblox .com heres the original code but make it smaller have embeeds and slash commands but work exactly how i describe it to
import discord from discord.ext import commands, tasks from discord import app_commands import aiohttp import asyncio import json import os from pathlib import Path
============================
Configuration - Fill in Your Details Below
============================
Discord Bot Token
TOKEN = "MTI5MjQzNTQ1NTA5ODQ4Njg0Ng.Gq5XkY.qDAyf9NNQ7QDg8ICS250WeTClUxakWmjwwaIR0" # Replace with your bot's token as a string
Notification Channel ID
NOTIFICATION_CHANNEL_ID = 1292505295028879360 # Replace with your Discord channel ID as an integer
Check Interval in Seconds
CHECK_INTERVAL = 15 # Adjust as needed (minimum is around 15 seconds due to rate limits)
============================
End of Configuration
============================
Determine the directory where the script is located
BASE_DIR = Path(file).parent
File to store monitoring data
DATA_FILE = BASE_DIR / 'monitoring.json'
Initialize monitoring data
if DATA_FILE.exists(): with open(DATA_FILE, 'r') as f: try: monitoring_data = json.load(f) except json.JSONDecodeError: monitoring_data = {} else: monitoring_data = {}
def save_monitoring_data(): """ Save the current monitoring data to a JSON file. """ with open(DATA_FILE, 'w') as f: json.dump(monitoring_data, f, indent=4)
Intents
intents = discord.Intents.default() intents.message_content = True # Ensure this is enabled in the Discord Developer Portal for your bot
Initialize Bot
bot = commands.Bot(command_prefix="!", intents=intents)
Tree for Slash Commands
tree = bot.tree
@bot.event async def on_ready(): """ Event handler called when the bot is ready. """ print(f"Logged in as {bot.user} (ID: {bot.user.id})") print("------") # Sync global commands (this might take up to an hour to propagate if not using guild-specific commands) await tree.sync() print("Commands synced globally.") monitor_users.start() # Start the background monitoring task
@tree.command(name="monitor", description="Monitor a Roblox user joining a specific game.") @app_commands.describe( userid="The Roblox User ID to monitor (numeric ID).", gameid="The Roblox Game ID to monitor (numeric ID)." ) async def monitor(interaction: discord.Interaction, userid: str, gameid: str): """ Start monitoring a Roblox user for when they join a specific game. """ if not userid.isdigit() or not gameid.isdigit(): await interaction.response.send_message("❌ Both and must be numeric IDs.", ephemeral=True) return
- Assistant