import discord from members import favelatonames, angelstonames from favela import…
- User
import discord from members import favela_to_names, angels_to_names from favela import favela from angels import check_angels
message_handler.py
async def handle_message(message, bot): # Add your user ID below user_id = [204221702404571136, 727947838079631421, 941168256805384193]
if message.author.id not in user_id: return # ignore messages from other users if isinstance(message.channel, discord.DMChannel): content = message.content.lower() if content == "status": channel = message.channel await favela(channel, favela_to_names) await check_angels(channel, angels_to_names) role_ids = { "Underboss": 1033678758416240670, "Capo": 1033678438613123092, "Soldier": 1033678818302492742, "Prospect": 1018559552079278150}
if isinstance(message.channel, discord.DMChannel): content = message.content.lower() if content == "announce": guild = bot.get_guild(1005511195568119939) author = message.author channel = message.channel # Step A: Ask for role ID via reactions role_message = await channel.send("Which roles do you want to send the announcement to? A. Underboss B. Capo C. Soldier D. Prospect E. All") for role_id in ["A", "B", "C", "D", "E"]: if role_id == "A": await role_message.add_reaction("🇦") # Underboss elif role_id == "B": await role_message.add_reaction("🇧") # Capo elif role_id == "C": await role_message.add_reaction("🇨") # Soldier elif role_id == "D": await role_message.add_reaction("🇩") # Prospect elif role_id == "E": await role_message.add_reaction("🇪") # All # Wait for user to react def check_reaction(reaction, user): return user == author and reaction.message == role_message and reaction.emoji in ["🇦", "🇧", "🇨", "🇩", "🇪"] reaction, _ = await bot.wait_for("reaction_add", check=check_reaction) # Get role IDs from reaction if reaction.emoji == "🇪": role_ids = ["A", "B", "C", "D"] elif reaction.emoji in ["🇦", "🇧", "🇨", "🇩"]: if reaction.emoji == "🇦": role_ids = ["A"] elif reaction.emoji == "🇧": role_ids = ["B"] elif reaction.emoji == "🇨": role_ids = ["C"] elif reaction.emoji == "🇩": role_ids = ["D"] else: return await channel.send("Invalid option selected.") # Step B: Ask for announcement content await channel.send("What do you want to announce?") announcement_message = await bot.wait_for("message", check=lambda m: m.author == author and m.channel == channel) # Step C: Confirm announcement confirmation_message = await channel.send(f"You want to announce '{announcement_message.content}' to role '{role_id}'. Is that correct?") # Wait for user to confirm await confirmation_message.add_reaction("✅") await confirmation_message.add_reaction("❌") def check_confirmation(reaction, user): return user == author and reaction.message == confirmation_message and reaction.emoji in ["✅", "❌"] reaction, _ = await bot.wait_for("reaction_add", check=check_confirmation) # Send announcement to role if reaction.emoji == "✅": sent_to_members = set() # Keep track of members who have received the message for role_id in role_ids: await channel.send(f"Could not find role '{role_id}' in guild '{guild.name}'") else: role = discord.utils.get(guild.roles, id=ROLE_IDS[role_id]) members = role.members if role is None: await channel.send(f"Could not find role '{role_id}' in guild '{guild.name}'") else: announcement = announcement_message.content members = role.members for member in members: if member not in sent_to_members: await member.send(announcement) sent_to_members.add(member) await channel.send(f"Announcement sent to {len(sent_to_members)} members of role '{role_id}'") else: await bot.process_commands(message) - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.