insert2-cogs/gameutils.py

32 lines
1.1 KiB
Python
Raw Normal View History

2024-08-10 17:30:06 +00:00
import nextcord
from nextcord.ext import commands, application_checks
from nextcord import TextInputStyle
import random
import aiosqlite as sqlite3
import aiohttp
from urllib.parse import urlparse
import os
class gameutils(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@nextcord.slash_command(
name="turngen",
description="Roll the next turn for a certian role",
guild_ids=[699285282276507708],
)
@nextcord.ext.application_checks.has_permissions(manage_roles=True)
async def turngen(self, interaction: nextcord.Interaction, role: nextcord.Role):
message = "It has been decreed..\n"
users = role.members
random.shuffle(users)
2024-08-10 17:34:27 +00:00
for i in range(len(users)):
2024-08-10 17:30:06 +00:00
message = message + f"{str(i+1)}. <@{users[i].id}>\n"
await interaction.response.send_message(message, allowed_mentions=nextcord.AllowedMentions.none())
2024-08-10 17:38:34 +00:00
await interaction.followup.send(f"{users[0]} it is now your turn!")
2024-08-10 17:30:06 +00:00
def setup(bot: commands.Bot):
bot.add_cog(gameutils(bot))