forked from HoloTech/hyperfocus-plugin
Add custom responses for hyperfocus
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ from data.columns import String, Integer, Timestamp
|
||||
|
||||
class Hyperfocuser(RowModel):
|
||||
_tablename_ = "hyperfocused"
|
||||
_cache_ = {}
|
||||
# _cache_ = {}
|
||||
|
||||
profileid = Integer(primary=True)
|
||||
started_at = Timestamp()
|
||||
|
||||
@@ -5,6 +5,7 @@ import datetime as dt
|
||||
from datetime import datetime, timedelta
|
||||
from math import ceil
|
||||
import time
|
||||
import random
|
||||
|
||||
import twitchio
|
||||
from twitchio import Scopes
|
||||
@@ -32,6 +33,18 @@ CHANNEL_SCOPES = Scopes(
|
||||
)
|
||||
)
|
||||
|
||||
responses = """
|
||||
🐱 Nice try. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
❌ This interaction has been reviewed and rejected. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
🚨 Nico has reviewed your message and found it unnecessary. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
📄 Nico gently places your message in the shredder. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
🧐 Nico believes your future self would rather you keep focusing. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
💭 That thought can wait until after the focus session. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
⚠️ Unauthorized yapping detected. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
🚫 Nico has denied your request to be distracted. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
❌ Nico recommends focusing instead. (You are in !hyperfocus. Use !unfocus if needed 🐾)
|
||||
""".splitlines()
|
||||
|
||||
|
||||
class FocusComponent(cmds.Component):
|
||||
def __init__(self, bot: Bot):
|
||||
@@ -161,16 +174,17 @@ class FocusComponent(cmds.Component):
|
||||
|
||||
if notify:
|
||||
self._last_deleted[profile.profileid] = now
|
||||
response_text = random.choice(responses)
|
||||
response_text = payload.chatter.mention + ' ' + response_text
|
||||
try:
|
||||
if deleted:
|
||||
await payload.broadcaster.send_message(
|
||||
f"@{payload.chatter.name} Stay focused! "
|
||||
"(You are in !hyperfocus, use !unfocus to come back if you need to!)",
|
||||
response_text,
|
||||
sender=self.bot.bot_id,
|
||||
)
|
||||
else:
|
||||
await payload.broadcaster.send_message(
|
||||
f"@{payload.chatter.name} Stay focused! ",
|
||||
response_text,
|
||||
sender=self.bot.bot_id,
|
||||
)
|
||||
except twitchio.exceptions.HTTPException:
|
||||
@@ -233,9 +247,7 @@ class FocusComponent(cmds.Component):
|
||||
|
||||
minutes = ceil(dur / 60)
|
||||
await ctx.reply(
|
||||
f"{ctx.chatter.name} has gone into HYPERFOCUS! "
|
||||
f"They will be in emote and command only mode for the next {minutes} minutes! "
|
||||
"Use !unfocus to come back if you need to, best of luck! ☘️🍀☘️ "
|
||||
f"🚨⚠️ Nico has decided distractions are illegal and activated HYPERFOCUS MODE. {ctx.chatter.name} will be in emote and command only mode for the next {minutes} minutes. Use !unfocus at your own risk. Nico is watching. kawaii16Stab"
|
||||
)
|
||||
|
||||
@cmds.command(name="unfocus", aliases=["uncrocus", "unhyper", "unhyperfocus"])
|
||||
@@ -248,8 +260,7 @@ class FocusComponent(cmds.Component):
|
||||
await self.channel.send_hyperfocus_del(profile.profileid)
|
||||
|
||||
await ctx.reply(
|
||||
"Welcome back from focus, hope it went well!"
|
||||
" Remember to have a sip and stretch if you need it~"
|
||||
"Nico has reluctantly granted your request. Welcome back to chat. 🐱✨"
|
||||
)
|
||||
|
||||
@cmds.command(name="hyperfocused")
|
||||
@@ -319,7 +330,7 @@ class FocusComponent(cmds.Component):
|
||||
async def focuslist_cmd(self, ctx):
|
||||
comm = await self.bot.profiles.fetch_community(ctx.broadcaster, touch=True)
|
||||
link = (
|
||||
f"https://croccyfocus.thewisewolf.dev/widget/?community={comm.communityid}"
|
||||
f"https://nicofocus.thewisewolf.dev/widget/?community={comm.communityid}"
|
||||
)
|
||||
await ctx.reply(
|
||||
f"Browser source link for your channel's hyperfocus: {link} (For troubleshooting: your community id is {comm.communityid})"
|
||||
|
||||
Reference in New Issue
Block a user