This commit is contained in:
insert 2024-08-10 13:30:06 -04:00
parent 1778fdcacc
commit c0090e30d8
Signed by: insert
GPG key ID: A70775C389ACF105
2 changed files with 32 additions and 1 deletions

31
gameutils.py Normal file
View file

@ -0,0 +1,31 @@
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)
for u in range(users):
message = message + f"{str(i+1)}. <@{users[i].id}>\n"
await interaction.response.send_message(message, allowed_mentions=nextcord.AllowedMentions.none())
def setup(bot: commands.Bot):
bot.add_cog(gameutils(bot))

View file

@ -51,7 +51,7 @@ class rolebutton(commands.Cog):
name="refresh", name="refresh",
description="refresh a role selection message", description="refresh a role selection message",
) )
async def rolerefresh(self, interaction: nextcord.Interaction, msgid: int): async def rolerefresh(self, interaction: nextcord.Interaction, msgid: float):
msg = await nextcord.abc.Messageable.fetch_message(msgid) msg = await nextcord.abc.Messageable.fetch_message(msgid)
if msg.author.id != self.bot.application_id: if msg.author.id != self.bot.application_id:
await interaction.response.send_message("I can't edit that message", ephemeral=True) await interaction.response.send_message("I can't edit that message", ephemeral=True)