Update
This commit is contained in:
parent
5fe69d4473
commit
4e6c824e60
1 changed files with 23 additions and 1 deletions
24
starboard.py
24
starboard.py
|
@ -22,7 +22,7 @@ class starboard(commands.Cog):
|
|||
print(payload.emoji.name, file=sys.stderr)
|
||||
chann = self.bot.get_channel(payload.channel_id)
|
||||
message = await chann.fetch_message(payload.message_id)
|
||||
res = await.cur.execute(f"SELECT emoji, starchannel, minimumneeded, selfstar FROM starsettings WHERE serverid = {message.guild.id}")
|
||||
res = await self.bot.cur.execute(f"SELECT emoji, starchannel, minimumneeded, selfstar FROM starsettings WHERE serverid = {message.guild.id}")
|
||||
try:
|
||||
emoji, starchannel, minimumneeded, selfstar = await res.fetchone()
|
||||
except TypeError:
|
||||
|
@ -36,5 +36,27 @@ class starboard(commands.Cog):
|
|||
await message.forward(self.bot.get_channel(starchannel))
|
||||
return
|
||||
|
||||
@nextcord.slash_command(
|
||||
name="starboard",
|
||||
description="For all your starring needs",
|
||||
default_member_permissions=nextcord.Permissions(manage_messages=True),
|
||||
)
|
||||
async def starboard(self, interaction: nextcord.Interaction):
|
||||
return
|
||||
|
||||
@starboard.subcommand(
|
||||
name="create",
|
||||
description="Create a starboard, escape the emoji",
|
||||
force_global=True,
|
||||
)
|
||||
async def createstarboard(self, interaction: nextcord.Interaction, reaction: str, channel: nextcord.channel, minimumneeded: int, selfstar: str = nextcord.SlashOption(choices=["Yes", "No"])):
|
||||
selfstar = False
|
||||
if selfstar == "Yes":
|
||||
selfstar = True
|
||||
await self.bot.cur.execute(f"""
|
||||
INSERT INTO userinfo VALUES
|
||||
({reaction}, {channel.id}, '{minimumneeded}', '{selfstar}', {interaction.guild_id})
|
||||
""")
|
||||
|
||||
def setup(bot: commands.Bot):
|
||||
bot.add_cog(starboard(bot))
|
Loading…
Reference in a new issue