output "santization" and ping list fix
This commit is contained in:
parent
a04fe9e7a7
commit
d9c157cfab
18
bot.py
18
bot.py
|
@ -59,8 +59,14 @@ def remove_ping(term, user_id):
|
|||
return False
|
||||
elif user_id not in ping_terms[term]:
|
||||
return False
|
||||
else:
|
||||
#if there is only one remaining person in the ping term list, delete the whole term
|
||||
if len(ping_terms[term]) == 1 and ping_terms[term][0] == user_id:
|
||||
del ping_terms[term]
|
||||
#if there is more than on person in the ping term list, delete only that user_id
|
||||
else:
|
||||
ping_terms[term].remove(user_id)
|
||||
|
||||
config["ping_terms"] = ping_terms
|
||||
save_config("config.json", config)
|
||||
return True
|
||||
|
@ -225,28 +231,28 @@ async def myLoop():
|
|||
@bot.slash_command(description="Pings you when auction name contains the given term")
|
||||
async def ping_me(interaction: nextcord.Interaction, term: str):
|
||||
if add_ping(term, interaction.user.id):
|
||||
await interaction.response.send_message(f"Success! You will be pinged for {term}", ephemeral=False)
|
||||
await interaction.response.send_message(f"Success! You will be pinged for `{term}`", ephemeral=False)
|
||||
else:
|
||||
pings = get_user_pings(interaction.user.id)
|
||||
if len(pings) > 0:
|
||||
await interaction.response.send_message(f"Failed to add {term}. You are pinged for {', '.join(pings)}",
|
||||
await interaction.response.send_message(f"Failed to add `{term}`. You are pinged for `{', '.join(pings)}`",
|
||||
ephemeral=True)
|
||||
else:
|
||||
await interaction.response.send_message(f"Failed to add {term}. You are not pinged for anything",
|
||||
await interaction.response.send_message(f"Failed to add `{term}`. You are not pinged for anything",
|
||||
ephemeral=True)
|
||||
|
||||
|
||||
@bot.slash_command(description="No longer pings you when auction name contains the given term")
|
||||
async def unping_me(interaction: nextcord.Interaction, term: str):
|
||||
if remove_ping(term, interaction.user.id):
|
||||
await interaction.response.send_message(f"Success! You will no longer be pinged for {term}", ephemeral=False)
|
||||
await interaction.response.send_message(f"Success! You will no longer be pinged for `{term}`", ephemeral=False)
|
||||
else:
|
||||
pings = get_user_pings(interaction.user.id)
|
||||
if len(pings) > 0:
|
||||
await interaction.response.send_message(f"Failed to remove {term}. You are pinged for {', '.join(pings)}",
|
||||
await interaction.response.send_message(f"Failed to remove `{term}`. You are pinged for `{', '.join(pings)}`",
|
||||
ephemeral=True)
|
||||
else:
|
||||
await interaction.response.send_message(f"Failed to remove {term}. You are not pinged for anything",
|
||||
await interaction.response.send_message(f"Failed to remove `{term}`. You are not pinged for anything",
|
||||
ephemeral=True)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue