forked from HoloTech/subathon-tracker-bot
Compare commits
10 Commits
3c3e857e28
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 46a0fea467 | |||
| 4683beb2c5 | |||
| d334f900f8 | |||
| 20db56cd7d | |||
| 7aed63f756 | |||
| 0ba39816c9 | |||
| ef7789dc9c | |||
| 280ef7fb64 | |||
| 2e60625e77 | |||
| 68d678c74f |
+4
-1
@@ -3,7 +3,7 @@
|
|||||||
url = https://git.thewisewolf.dev/HoloTech/psqlmapper.git
|
url = https://git.thewisewolf.dev/HoloTech/psqlmapper.git
|
||||||
[submodule "src/modules/subathon"]
|
[submodule "src/modules/subathon"]
|
||||||
path = src/modules/subathon
|
path = src/modules/subathon
|
||||||
url = https://git.thewisewolf.dev/HoloTech/twitch-subathon-plugin.git
|
url = https://git.thewisewolf.dev/CarmiCoven/lilac-subathon-plugin.git
|
||||||
[submodule "src/modules/tracker"]
|
[submodule "src/modules/tracker"]
|
||||||
path = src/modules/tracker
|
path = src/modules/tracker
|
||||||
url = https://git.thewisewolf.dev/HoloTech/twitch-eventtracker-plugin.git
|
url = https://git.thewisewolf.dev/HoloTech/twitch-eventtracker-plugin.git
|
||||||
@@ -13,3 +13,6 @@
|
|||||||
[submodule "src/modules/exec"]
|
[submodule "src/modules/exec"]
|
||||||
path = src/modules/exec
|
path = src/modules/exec
|
||||||
url = https://git.thewisewolf.dev/HoloTech/exec-plugin.git
|
url = https://git.thewisewolf.dev/HoloTech/exec-plugin.git
|
||||||
|
[submodule "src/modules/pluscampaign"]
|
||||||
|
path = src/modules/pluscampaign
|
||||||
|
url = https://git.thewisewolf.dev/CarmiCoven/pluscampaign-plugin.git
|
||||||
|
|||||||
@@ -17,6 +17,18 @@ BEGIN
|
|||||||
END;
|
END;
|
||||||
$$ language 'plpgsql';
|
$$ language 'plpgsql';
|
||||||
|
|
||||||
|
CREATE OR REPLACE FUNCTION current_module_version(module_name TEXT)
|
||||||
|
RETURNS INTEGER
|
||||||
|
AS $$
|
||||||
|
SELECT
|
||||||
|
to_version
|
||||||
|
FROM version_history
|
||||||
|
WHERE
|
||||||
|
component = $1
|
||||||
|
ORDER BY _timestamp DESC
|
||||||
|
LIMIT 1;
|
||||||
|
$$ LANGUAGE SQL;
|
||||||
|
|
||||||
CREATE TABLE app_config(
|
CREATE TABLE app_config(
|
||||||
appname TEXT PRIMARY KEY,
|
appname TEXT PRIMARY KEY,
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||||
|
|||||||
@@ -197,3 +197,9 @@ class Bot(commands.Bot):
|
|||||||
await self.add_token(row.token, row.refresh_token)
|
await self.add_token(row.token, row.refresh_token)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(f"Failed to add token for {row}")
|
logger.exception(f"Failed to add token for {row}")
|
||||||
|
|
||||||
|
async def event_command_error(self, payload: commands.CommandErrorPayload) -> None:
|
||||||
|
if isinstance(payload.exception, commands.CommandNotFound):
|
||||||
|
logger.debug(f"Attempt to execute nonexistent command for context {payload.context!r}")
|
||||||
|
else:
|
||||||
|
return await super().event_command_error(payload)
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
async def twitch_setup(bot: "Bot"):
|
async def twitch_setup(bot: "Bot"):
|
||||||
# Import and run setup methods from each module
|
# Import and run setup methods from each module
|
||||||
from . import profiles, tracker, subathon, exec
|
from . import profiles, tracker, subathon, exec, yarn
|
||||||
|
|
||||||
await profiles.twitch_setup(bot)
|
await profiles.twitch_setup(bot)
|
||||||
await tracker.twitch_setup(bot)
|
await tracker.twitch_setup(bot)
|
||||||
await subathon.twitch_setup(bot)
|
await subathon.twitch_setup(bot)
|
||||||
await exec.twitch_setup(bot)
|
await exec.twitch_setup(bot)
|
||||||
|
await yarn.twitch_setup(bot)
|
||||||
|
|||||||
Submodule
+1
Submodule src/modules/pluscampaign added at 97bdf8e8e3
+1
-1
Submodule src/modules/subathon updated: 11c77bcc89...297eb434d4
+1
-1
Submodule src/modules/tracker updated: f853f01bf8...2f4778d0b8
@@ -0,0 +1,7 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
async def twitch_setup(bot):
|
||||||
|
from .component import YarnComponent
|
||||||
|
await bot.add_component(YarnComponent(bot))
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
import twitchio
|
||||||
|
from twitchio import PartialUser, Scopes, eventsub
|
||||||
|
from twitchio.ext import commands as cmds
|
||||||
|
|
||||||
|
from meta import Bot, Context
|
||||||
|
|
||||||
|
from . import logger
|
||||||
|
|
||||||
|
class YarnComponent(cmds.Component):
|
||||||
|
def __init__(self, bot: Bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
|
||||||
|
@cmds.Component.listener()
|
||||||
|
async def event_custom_redemption_add(self, payload: twitchio.ChannelPointsRedemptionAdd):
|
||||||
|
logger.info(f"Yarn got {payload!r}")
|
||||||
|
if payload.reward.title == 'pet lilac':
|
||||||
|
await payload.broadcaster.send_message("lilac PETPET", sender="1097964183")
|
||||||
Reference in New Issue
Block a user