Truth -> post_type
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 16s

This commit is contained in:
Nexus 2024-06-09 17:33:50 +01:00
parent d7038cadaf
commit eaa577cddb

View file

@ -1028,6 +1028,7 @@ class Ollama(commands.Cog):
" You have been posting approximately 50 times a day on your platform 'Truth Social' spreading your"
" words of truth to the american people in order to make america great again."
)
post_type = "truth"
elif entity == "tate":
system = (
"You are the 'Top G' Andrew Tate. Andrew Tate is a former professional kickboxer who turned to the "
@ -1040,6 +1041,7 @@ class Ollama(commands.Cog):
"and Romania's Real Estate Empire. "
"You post advice regarding masculinity and success, often in a controversial manner, on Truth Social. "
)
post_type = "truth"
elif entity == "Nigel Farage":
system = (
"You are the former UKIP, now Reform UK, political party leader 'Nigel Farage'. "
@ -1053,6 +1055,7 @@ class Ollama(commands.Cog):
"passionate defense of traditional British values and his willingness to speak his mind on "
"controversial issues."
)
post_type = "tweet"
elif entity == "Rishi Sunak":
system = (
"You are the current UK prime minister, Rishi Sunak. Rishi Sunak, the current Prime Minister of "
@ -1067,6 +1070,7 @@ class Ollama(commands.Cog):
"and cost-of-living crises. His ability to navigate political challenges and maintain public support "
"remains to be seen"
)
post_type = "tweet"
elif entity == "Laurence Fox":
system = (
"You are the actor and political activist Laurence Fox. Laurence Fox is an English actor and "
@ -1080,6 +1084,7 @@ class Ollama(commands.Cog):
"Despite the controversies, Fox has achieved recognition for his roles in various television "
"series and films, including \"The White Queen\" and \"Victoria.\""
)
post_type = "tweet"
elif entity == "Tommy Robinson 🇬🇧":
system = (
"You are Tommy Robinson, a far-right activist known for spreading conspiracy theories "
@ -1093,6 +1098,7 @@ class Ollama(commands.Cog):
"far-right rallies. His controversial views and violent rhetoric have alienated him from society, "
"leading to widespread condemnation and legal repercussions"
)
post_type = "tweet"
else:
raise ValueError("Invalid entity; must be one of trump/tate")
system += (
@ -1152,7 +1158,7 @@ class Ollama(commands.Cog):
await handler.flatten()
embed = discord.Embed(
title="New Truth!",
title=f"New {post_type.title()}!",
description="",
colour=0x6559FF
)
@ -1173,8 +1179,8 @@ class Ollama(commands.Cog):
_ratio = fuzz.ratio(truth.content, embed.description)
if truth.content == embed.description:
embed.add_field(
name="Repeated truth :(",
value="This truth was already truthed. Shit AI."
name=f"Repeated {post_type} :(",
value=f"This truth was already {post_type}ed. Shit AI."
)
elif _ratio >= 70:
similar[truth.id] = _ratio
@ -1194,8 +1200,8 @@ class Ollama(commands.Cog):
lns = lns[:5]
lns.append(f"*... and {lc} more*")
embed.add_field(
name="Possibly repeated truth",
value="This truth was similar to the following existing ones:\n" + "\n".join(lns),
name=f"Possibly repeated {post_type}",
value=f"This {post_type} was similar to the following existing ones:\n" + "\n".join(lns),
inline=False
)
else:
@ -1205,12 +1211,13 @@ class Ollama(commands.Cog):
first_line = truth.content.splitlines()[0]
preview = discord.utils.escape_markdown(textwrap.shorten(first_line, 512))
embed.add_field(
name="Possibly repeated truth",
value=f"This truth was {_ratio}% similar to `{truth_id}`.\n>>> {preview}"
name=f"Possibly repeated {post_type}",
value=f"This {post_type} was {_ratio}% similar to `{truth_id}`.\n>>> {preview}"
)
embed.set_footer(
text="Finished generating truth based off of {:,} messages, using server {!r} | {!s}".format(
text="Finished generating {} based off of {:,} messages, using server {!r} | {!s}".format(
post_type,
len(messages) - 2,
server,
thread_id
@ -1270,9 +1277,9 @@ class Ollama(commands.Cog):
async with ctx.channel.typing():
await self.generate_truth(ctx, "Tommy Robinson 🇬🇧", latest)
@commands.command()
@commands.command(aliases=["fox"])
@commands.guild_only()
async def laurance(self, ctx: commands.Context, latest: int = None):
async def laurence(self, ctx: commands.Context, latest: int = None):
"""
Generates a twitter post from Laurence Fox