Compare commits

...

8 Commits

Author SHA1 Message Date
076987a4d5 (routine): Update requirements. 2025-09-04 04:02:43 +10:00
e7de69c0ac (twitch): Reduce block length. 2025-09-04 03:37:22 +10:00
9cedd88405 (twitch): Fix typo in koan. 2025-09-04 03:32:49 +10:00
3a7c2ba9d3 (twitch): Fix koan display. 2025-09-04 03:31:59 +10:00
2d31804982 Fix koan display. 2025-09-04 03:28:11 +10:00
27bfa47b42 Fix minify error. 2025-09-04 03:25:39 +10:00
a83081d482 Fix typo in minify 2025-09-04 03:19:00 +10:00
5388cba6e4 fix: Typos 2025-09-04 02:52:47 +10:00
3 changed files with 13 additions and 13 deletions

View File

@@ -4,15 +4,15 @@ from datetime import datetime
def minify(content: str, maxlength: int, strip: Optional[str] = ' ', newlines: str = ' '):
content.replace('\n', newlines)
content = content.replace('\n', newlines)
if strip:
content = content.strip(strip)
if len(content) > maxlength:
new_content = content[maxlength-3] + '...'
new_content = content[:maxlength-3] + '...'
else:
new_content = content
return content
return new_content
def utc_now():

View File

@@ -84,8 +84,6 @@ class KoanComponent(cmds.Component):
await ctx.reply(f"Koan #{koan.koanlabel} created!")
# TODO: Error message on signature failure
@koans.command(name='edit', aliases=['update',])
@cmds.is_moderator()
async def koans_edit(self, ctx: cmds.Context, label: int, *, new_content: str):
@@ -131,19 +129,19 @@ class KoanComponent(cmds.Component):
community = await self.bot.profiles.fetch_community(ctx.broadcaster)
cid = community.communityid
koan = None
if label is not None:
koan = await self.koans.get_koan_label(cid, label)
if koan:
await ctx.reply(koan.message)
else:
if not koan:
await ctx.reply(f"Koan #{label} does not exist!")
else:
koans = await self.koan.get_community_koans(communityid=cid)
koans = await self.koans.get_community_koans(communityid=cid)
if koans:
koan = random.choice(koans)
formatted = f"Koan #{koan.koanlabel}: {koan.message}"
parts = [formatted[i: i:500] for i in range(0, len(formatted), 500)]
for part in parts:
await ctx.reply(part)
else:
await ctx.reply("This channel doesn't have any koans!")
if koan:
formatted = f"Koan #{koan.koanlabel}: {koan.content}"
parts = [formatted[i : i+450] for i in range(0, len(formatted), 450)]
for part in parts:
await ctx.reply(part)

View File

@@ -0,0 +1,2 @@
discord.py
twitchio