misc: changed coco to autoreact, removed polarisxpconvert command
This commit is contained in:
parent
ad393dde4b
commit
06599441e4
1 changed files with 36 additions and 54 deletions
|
@ -14,27 +14,10 @@ class Galaxy(commands.Cog):
|
|||
self.bot = bot
|
||||
self.config = Config.get_conf(self, identifier=6621962)
|
||||
self.config.register_guild(
|
||||
cocotarget = 0,
|
||||
cocoemoji = 1028535684757209118
|
||||
autoreact_target = 0,
|
||||
autoreact_emoji = 1028535684757209118
|
||||
)
|
||||
|
||||
@commands.command(aliases=["pxc", "pc", "polarisconvert", "tatsutopolaris", "ttp"])
|
||||
@commands.guild_only()
|
||||
async def polarisxpconvert(self, ctx, *, tatsu_studs: str):
|
||||
"""Converts Tatsu Studs to Polaris XP."""
|
||||
try:
|
||||
tatsu_studs_int = int(f"{tatsu_studs}".replace(",", ""))
|
||||
except ValueError:
|
||||
await ctx.send(content="Please input a number!")
|
||||
return
|
||||
math = round((tatsu_studs_int/25)*10)
|
||||
output_from = f'{tatsu_studs_int:,}'
|
||||
output_to = f'{math:,}'
|
||||
embed = discord.Embed(color=await self.bot.get_embed_color(None))
|
||||
embed.add_field(name="Tatsu Studs", value=f"{output_from}", inline=False)
|
||||
embed.add_field(name="Polaris XP", value=f"{output_to}", inline=False)
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.command()
|
||||
@checks.is_owner()
|
||||
async def nslookup(self, ctx: commands.Context, *, website: str):
|
||||
|
@ -47,7 +30,6 @@ class Galaxy(commands.Cog):
|
|||
except FileNotFoundError:
|
||||
await ctx.send("`nslookup` command not found. Make sure you have `nslookup` installed and it's in your system PATH.")
|
||||
|
||||
|
||||
@commands.command()
|
||||
async def galaxyissues(self, ctx, target: discord.Member = None):
|
||||
if ctx.me.id == 1070819799254438039:
|
||||
|
@ -68,35 +50,35 @@ class Galaxy(commands.Cog):
|
|||
await ctx.send(f"Output link: {output}")
|
||||
|
||||
@commands.Cog.listener('on_message')
|
||||
async def cocoreact(self, message):
|
||||
async def autoreact(self, message):
|
||||
if message.guild is not None:
|
||||
emoji_id = await self.config.guild(message.guild).cocoemoji()
|
||||
emoji_id = await self.config.guild(message.guild).autoreact_emoji()
|
||||
if self.check_if_discord_unicode_emoji(emoji_id) is False:
|
||||
emoji = self.bot.get_emoji(emoji_id)
|
||||
elif self.check_if_discord_unicode_emoji(emoji_id) is True:
|
||||
emoji = emoji_id
|
||||
cocotarget = await self.config.guild(message.guild).cocotarget()
|
||||
if cocotarget == 0:
|
||||
autoreact_target = await self.config.guild(message.guild).autoreact_target()
|
||||
if autoreact_target == 0:
|
||||
return
|
||||
if not message.author.id == cocotarget:
|
||||
if not message.author.id == autoreact_target:
|
||||
return
|
||||
await message.add_reaction(emoji)
|
||||
|
||||
@commands.command(name='coco')
|
||||
@commands.command(name='autoreact')
|
||||
@commands.guild_only()
|
||||
async def coco_list(self, ctx: commands.Context):
|
||||
"""Checks who Coco is currently set to."""
|
||||
emoji_id = await self.config.guild(ctx.guild).cocoemoji()
|
||||
cocotarget = await self.config.guild(ctx.guild).cocotarget()
|
||||
async def autoreact_list(self, ctx: commands.Context):
|
||||
"""Checks Autoreact's settings."""
|
||||
emoji_id = await self.config.guild(ctx.guild).autoreact_emoji()
|
||||
autoreact_target = await self.config.guild(ctx.guild).autoreact_target()
|
||||
if self.check_if_discord_unicode_emoji(emoji_id) is True:
|
||||
emoji = emoji_id
|
||||
embed = discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco is currently set to <@{cocotarget}> ({cocotarget}).\nCoco's emoji is currently set to {emoji}.")
|
||||
embed = discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact is currently set to target <@{autoreact_target}> ({autoreact_target}).\Autoreact's emoji is currently set to {emoji}.")
|
||||
else:
|
||||
emoji = self.bot.get_emoji(emoji_id)
|
||||
embed = discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco is currently set to <@{cocotarget}> ({cocotarget}).\nCoco's emoji is currently set to {emoji} ({await self.config.guild(ctx.guild).cocoemoji()}).")
|
||||
embed = discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact is currently set to target <@{autoreact_target}> ({autoreact_target}).\Autoreact's emoji is currently set to {emoji} ({await self.config.guild(ctx.guild).autoreact_emoji()}).")
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
coco = app_commands.Group(name='coco', guild_only=True, description="This group handles the autoreact functionality.")
|
||||
autoreact = app_commands.Group(name='autoreact', guild_only=True, description="This group handles the autoreact functionality.")
|
||||
|
||||
def check_if_discord_unicode_emoji(self, emoji: str):
|
||||
emoji_ranges = [
|
||||
|
@ -122,14 +104,14 @@ class Galaxy(commands.Cog):
|
|||
else:
|
||||
return input_string
|
||||
|
||||
@coco.command(name="emoji")
|
||||
@app_commands.describe(emoji="Which emoji are you setting Coco to use?")
|
||||
async def coco_emoji(self, interaction: discord.Interaction, emoji: str = None):
|
||||
"""Sets Coco's emoji."""
|
||||
@autoreact.command(name="emoji")
|
||||
@app_commands.describe(emoji="Which emoji are you setting Autoreact to use?")
|
||||
async def autoreact_emoji(self, interaction: discord.Interaction, emoji: str = None):
|
||||
"""Sets autoreact's emoji."""
|
||||
if emoji:
|
||||
if self.check_if_discord_unicode_emoji(emoji) is True:
|
||||
await self.config.guild(interaction.guild).cocoemoji.set(emoji)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco's emoji has been set to {emoji}.")
|
||||
await self.config.guild(interaction.guild).autoreactemoji.set(emoji)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's emoji has been set to {emoji}.")
|
||||
await interaction.response.send_message(embed=embed)
|
||||
else:
|
||||
emoji_id = self.extract_id(input_string=emoji)
|
||||
|
@ -139,32 +121,32 @@ class Galaxy(commands.Cog):
|
|||
emoji_obj = emoji_to_find
|
||||
break
|
||||
else:
|
||||
await interaction.response.send_message(content=f"You're trying to set the coco emoji to an emoji I don't have access to!", ephemeral=True)
|
||||
await interaction.response.send_message(content=f"You're trying to set the autoreact emoji to an emoji I don't have access to!", ephemeral=True)
|
||||
return
|
||||
await self.config.guild(interaction.guild).cocoemoji.set(emoji_obj.id)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco's emoji has been set to {emoji_obj} ({emoji_obj.id}).")
|
||||
await self.config.guild(interaction.guild).autoreact_emoji.set(emoji_obj.id)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's emoji has been set to {emoji_obj} ({emoji_obj.id}).")
|
||||
await interaction.response.send_message(embed=embed)
|
||||
else:
|
||||
await self.config.guild(interaction.guild).cocoemoji.set('💀')
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco's emoji has been set to 💀.")
|
||||
await self.config.guild(interaction.guild).autoreact_emoji.set('💀')
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's emoji has been set to 💀.")
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
||||
@coco.command(name="set")
|
||||
@autoreact.command(name="set")
|
||||
@app_commands.describe(member="Who are you targetting?")
|
||||
async def coco_set(self, interaction: discord.Interaction, member: discord.Member):
|
||||
"""Sets Coco's target."""
|
||||
async def autoreact_set(self, interaction: discord.Interaction, member: discord.Member):
|
||||
"""Sets Autoreact's target."""
|
||||
if member:
|
||||
await self.config.guild(interaction.guild).cocotarget.set(member.id)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco has been set to {member.mention} ({member.id}).")
|
||||
await self.config.guild(interaction.guild).autoreact_target.set(member.id)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact has been set to automatically react to {member.mention} ({member.id})'s messages.")
|
||||
await interaction.response.send_message(embed=embed)
|
||||
else:
|
||||
await interaction.response.send_message(content="That is not a valid argument!", ephemeral=True)
|
||||
|
||||
@coco.command(name="reset")
|
||||
async def coco_reset(self, interaction: discord.Interaction):
|
||||
"""Resets Coco's target."""
|
||||
await self.config.guild(interaction.guild).cocotarget.set(0)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Coco has been reset.")
|
||||
@autoreact.command(name="reset")
|
||||
async def autoreact_reset(self, interaction: discord.Interaction):
|
||||
"""Resets Autoreact's target."""
|
||||
await self.config.guild(interaction.guild).autoreact_target.set(0)
|
||||
embed=discord.Embed(color=await self.bot.get_embed_color(None), description=f"Autoreact's target has been reset.")
|
||||
await interaction.response.send_message(embed=embed)
|
||||
|
||||
@commands.command()
|
||||
|
|
Loading…
Reference in a new issue