Compare commits
1 Commits
master
...
9c834c1c4e
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c834c1c4e |
+1
-1
@@ -4,7 +4,7 @@ from data.columns import String, Integer, Timestamp
|
|||||||
|
|
||||||
class Hyperfocuser(RowModel):
|
class Hyperfocuser(RowModel):
|
||||||
_tablename_ = "hyperfocused"
|
_tablename_ = "hyperfocused"
|
||||||
_cache_ = {}
|
# _cache_ = {}
|
||||||
|
|
||||||
profileid = Integer(primary=True)
|
profileid = Integer(primary=True)
|
||||||
started_at = Timestamp()
|
started_at = Timestamp()
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import datetime as dt
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from math import ceil
|
from math import ceil
|
||||||
import time
|
import time
|
||||||
|
import random
|
||||||
|
|
||||||
import twitchio
|
import twitchio
|
||||||
from twitchio import Scopes
|
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):
|
class FocusComponent(cmds.Component):
|
||||||
def __init__(self, bot: Bot):
|
def __init__(self, bot: Bot):
|
||||||
@@ -161,16 +174,17 @@ class FocusComponent(cmds.Component):
|
|||||||
|
|
||||||
if notify:
|
if notify:
|
||||||
self._last_deleted[profile.profileid] = now
|
self._last_deleted[profile.profileid] = now
|
||||||
|
response_text = random.choice(responses)
|
||||||
|
response_text = payload.chatter.mention + ' ' + response_text
|
||||||
try:
|
try:
|
||||||
if deleted:
|
if deleted:
|
||||||
await payload.broadcaster.send_message(
|
await payload.broadcaster.send_message(
|
||||||
f"@{payload.chatter.name} Stay focused! "
|
response_text,
|
||||||
"(You are in !hyperfocus, use !unfocus to come back if you need to!)",
|
|
||||||
sender=self.bot.bot_id,
|
sender=self.bot.bot_id,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await payload.broadcaster.send_message(
|
await payload.broadcaster.send_message(
|
||||||
f"@{payload.chatter.name} Stay focused! ",
|
response_text,
|
||||||
sender=self.bot.bot_id,
|
sender=self.bot.bot_id,
|
||||||
)
|
)
|
||||||
except twitchio.exceptions.HTTPException:
|
except twitchio.exceptions.HTTPException:
|
||||||
@@ -233,9 +247,7 @@ class FocusComponent(cmds.Component):
|
|||||||
|
|
||||||
minutes = ceil(dur / 60)
|
minutes = ceil(dur / 60)
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
f"{ctx.chatter.name} has gone into HYPERFOCUS! "
|
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"
|
||||||
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! ☘️🍀☘️ "
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@cmds.command(name="unfocus", aliases=["uncrocus", "unhyper", "unhyperfocus"])
|
@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 self.channel.send_hyperfocus_del(profile.profileid)
|
||||||
|
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
"Welcome back from focus, hope it went well!"
|
"Nico has reluctantly granted your request. Welcome back to chat. 🐱✨"
|
||||||
" Remember to have a sip and stretch if you need it~"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@cmds.command(name="hyperfocused")
|
@cmds.command(name="hyperfocused")
|
||||||
@@ -319,7 +330,7 @@ class FocusComponent(cmds.Component):
|
|||||||
async def focuslist_cmd(self, ctx):
|
async def focuslist_cmd(self, ctx):
|
||||||
comm = await self.bot.profiles.fetch_community(ctx.broadcaster, touch=True)
|
comm = await self.bot.profiles.fetch_community(ctx.broadcaster, touch=True)
|
||||||
link = (
|
link = (
|
||||||
f"https://croccyfocus.thewisewolf.dev/widget/?community={comm.communityid}"
|
f"https://nicofocus.thewisewolf.dev/widget/?community={comm.communityid}"
|
||||||
)
|
)
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
f"Browser source link for your channel's hyperfocus: {link} (For troubleshooting: your community id is {comm.communityid})"
|
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