diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 859adfaf..80c10716 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -46,7 +46,7 @@ --color-important-background: #cd526a05; --color-note-background--title: #269da1; --color-note-background: #269da105; - --color-versionadd-background--title: #5aa569; + --color-versionadd-background--title: #3c4d5f; --color-versionadd-background: #5aa56905; --color-versionchange-background--title: #616faf; --color-versionchange-background: #616faf05; @@ -244,7 +244,8 @@ th { } .versionadded { - background-color: var(--color-versionadd-background) !important; + background-color: transparent !important; + box-shadow: none !important; } .versionmodified.added { @@ -392,6 +393,10 @@ body.theme-dark { blockquote { border-color: #2b4459!important; } + + .versionadded { + background-color: transparent !important; + } } .theme-dark { @@ -641,6 +646,7 @@ dl.py > dd { .versionmodified { padding: .25rem .5rem; + font-size: 0.9em; } /* Fix padding on meth/prop dd */ diff --git a/docs/getting-started/changelog.rst b/docs/getting-started/changelog.rst index 0564766e..95937776 100644 --- a/docs/getting-started/changelog.rst +++ b/docs/getting-started/changelog.rst @@ -21,6 +21,68 @@ Changelog - :meth:`twitchio.Clip.fetch_video` now properly returns ``None`` when the :class:`twitchio.Clip` has no ``video_id``. - :class:`twitchio.ChatterColor` no longer errors whan no valid hex is provided by Twitch. +- twitchio.eventsub + - Additions + - Added :meth:`twitchio.AutomodMessageHold.respond` + - Added :meth:`twitchio.AutomodSettingsUpdate.respond` + - Added :meth:`twitchio.AutomodTermsUpdate.respond` + - Added :meth:`twitchio.ChannelBitsUse.respond` + - Added :meth:`twitchio.ChannelUpdate.respond` + - Added :meth:`twitchio.ChannelFollow.respond` + - Added :meth:`twitchio.ChannelAdBreakBegin.respond` + - Added :meth:`twitchio.ChannelChatClear.respond` + - Added :meth:`twitchio.ChannelChatClearUserMessages.respond` + - Added :meth:`twitchio.ChatMessage.respond` + - Added :meth:`twitchio.ChatNotification.respond` + - Added :meth:`twitchio.ChatMessageDelete.respond` + - Added :meth:`twitchio.ChatSettingsUpdate.respond` + - Added :meth:`twitchio.SharedChatSessionBegin.respond` + - Added :meth:`twitchio.SharedChatSessionUpdate.respond` + - Added :meth:`twitchio.SharedChatSessionEnd.respond` + - Added :meth:`twitchio.ChannelSubscribe.respond` + - Added :meth:`twitchio.ChannelSubscriptionEnd.respond` + - Added :meth:`twitchio.ChannelSubscriptionGift.respond` + - Added :meth:`twitchio.ChannelSubscriptionMessage.respond` + - Added :meth:`twitchio.ChannelCheer.respond` + - Added :meth:`twitchio.ChannelBan.respond` + - Added :meth:`twitchio.ChannelUnban.respond` + - Added :meth:`twitchio.ChannelUnbanRequest.respond` + - Added :meth:`twitchio.ChannelUnbanRequestResolve.respond` + - Added :meth:`twitchio.ChannelModerate.respond` + - Added :meth:`twitchio.ChannelModeratorAdd.respond` + - Added :meth:`twitchio.ChannelModeratorRemove.respond` + - Added :meth:`twitchio.ChannelPointsAutoRedeemAdd.respond` + - Added :meth:`twitchio.ChannelPointsReward.respond` + - Added :meth:`twitchio.ChannelPointsRedemptionAdd.respond` + - Added :meth:`twitchio.ChannelPointsRedemptionUpdate.respond` + - Added :meth:`twitchio.ChannelPollBegin.respond` + - Added :meth:`twitchio.ChannelPollProgress.respond` + - Added :meth:`twitchio.ChannelPollEnd.respond` + - Added :meth:`twitchio.ChannelPredictionBegin.respond` + - Added :meth:`twitchio.ChannelPredictionProgress.respond` + - Added :meth:`twitchio.ChannelPredictionLock.respond` + - Added :meth:`twitchio.ChannelPredictionEnd.respond` + - Added :meth:`twitchio.SuspiciousUserUpdate.respond` + - Added :meth:`twitchio.SuspiciousUserMessage.respond` + - Added :meth:`twitchio.ChannelVIPAdd.respond` + - Added :meth:`twitchio.ChannelVIPRemove.respond` + - Added :meth:`twitchio.ChannelWarningAcknowledge.respond` + - Added :meth:`twitchio.ChannelWarningSend.respond` + - Added :meth:`twitchio.BaseCharityCampaign.respond` + - Added :meth:`twitchio.CharityCampaignDonation.respond` + - Added :meth:`twitchio.GoalBegin.respond` + - Added :meth:`twitchio.GoalProgress.respond` + - Added :meth:`twitchio.GoalEnd.respond` + - Added :meth:`twitchio.HypeTrainBegin.respond` + - Added :meth:`twitchio.HypeTrainProgress.respond` + - Added :meth:`twitchio.HypeTrainEnd.respond` + - Added :meth:`twitchio.ShieldModeBegin.respond` + - Added :meth:`twitchio.ShieldModeEnd.respond` + - Added :meth:`twitchio.ShoutoutCreate.respond` + - Added :meth:`twitchio.ShoutoutReceive.respond` + - Added :meth:`twitchio.StreamOnline.respond` + - Added :meth:`twitchio.StreamOffline.respond` + - ext.commands - Additions - Added :class:`~twitchio.ext.commands.Converter` diff --git a/docs/references/eventsub/eventsub_models.rst b/docs/references/eventsub/eventsub_models.rst index b9279a0b..3d615efb 100644 --- a/docs/references/eventsub/eventsub_models.rst +++ b/docs/references/eventsub/eventsub_models.rst @@ -5,6 +5,7 @@ .. autoclass:: twitchio.AutomodMessageHold() :members: + :inherited-members: .. attributetable:: twitchio.AutomodBlockedTerm @@ -24,46 +25,55 @@ .. autoclass:: twitchio.AutomodSettingsUpdate() :members: + :inherited-members: .. attributetable:: twitchio.AutomodTermsUpdate .. autoclass:: twitchio.AutomodTermsUpdate() :members: + :inherited-members: .. attributetable:: twitchio.AutoRedeemReward .. autoclass:: twitchio.AutoRedeemReward() :members: + :inherited-members: .. attributetable:: twitchio.ChannelUpdate .. autoclass:: twitchio.ChannelUpdate() :members: + :inherited-members: .. attributetable:: twitchio.ChannelFollow .. autoclass:: twitchio.ChannelFollow() :members: + :inherited-members: .. attributetable:: twitchio.ChannelAdBreakBegin .. autoclass:: twitchio.ChannelAdBreakBegin() :members: + :inherited-members: .. attributetable:: twitchio.ChannelBitsUse .. autoclass:: twitchio.ChannelBitsUse() :members: + :inherited-members: .. attributetable:: twitchio.ChannelChatClear .. autoclass:: twitchio.ChannelChatClear() :members: + :inherited-members: .. attributetable:: twitchio.ChannelChatClearUserMessages .. autoclass:: twitchio.ChannelChatClearUserMessages() :members: + :inherited-members: .. attributetable:: twitchio.BaseChatMessage @@ -104,6 +114,7 @@ .. autoclass:: twitchio.ChatMessage() :members: + :inherited-members: .. attributetable:: twitchio.ChatSub @@ -169,16 +180,19 @@ .. autoclass:: twitchio.ChatNotification() :members: + :inherited-members: .. attributetable:: twitchio.ChatMessageDelete .. autoclass:: twitchio.ChatMessageDelete() :members: + :inherited-members: .. attributetable:: twitchio.ChatSettingsUpdate .. autoclass:: twitchio.ChatSettingsUpdate() :members: + :inherited-members: .. attributetable:: twitchio.ChatUserMessageHold @@ -194,31 +208,37 @@ .. autoclass:: twitchio.SharedChatSessionBegin() :members: + :inherited-members: .. attributetable:: twitchio.SharedChatSessionUpdate .. autoclass:: twitchio.SharedChatSessionUpdate() :members: + :inherited-members: .. attributetable:: twitchio.SharedChatSessionEnd .. autoclass:: twitchio.SharedChatSessionEnd() :members: + :inherited-members: .. attributetable:: twitchio.ChannelSubscribe .. autoclass:: twitchio.ChannelSubscribe() :members: + :inherited-members: .. attributetable:: twitchio.ChannelSubscriptionEnd .. autoclass:: twitchio.ChannelSubscriptionEnd() :members: + :inherited-members: .. attributetable:: twitchio.ChannelSubscriptionGift .. autoclass:: twitchio.ChannelSubscriptionGift() :members: + :inherited-members: .. attributetable:: twitchio.SubscribeEmote @@ -229,11 +249,13 @@ .. autoclass:: twitchio.ChannelSubscriptionMessage() :members: + :inherited-members: .. attributetable:: twitchio.ChannelCheer .. autoclass:: twitchio.ChannelCheer() :members: + :inherited-members: .. attributetable:: twitchio.ChannelRaid @@ -244,21 +266,25 @@ .. autoclass:: twitchio.ChannelBan() :members: + :inherited-members: .. attributetable:: twitchio.ChannelUnban .. autoclass:: twitchio.ChannelUnban() :members: + :inherited-members: .. attributetable:: twitchio.ChannelUnbanRequest .. autoclass:: twitchio.ChannelUnbanRequest() :members: + :inherited-members: .. attributetable:: twitchio.ChannelUnbanRequestResolve .. autoclass:: twitchio.ChannelUnbanRequestResolve() :members: + :inherited-members: .. attributetable:: twitchio.ModerateFollowers @@ -309,16 +335,19 @@ .. autoclass:: twitchio.ChannelModerate() :members: + :inherited-members: .. attributetable:: twitchio.ChannelModeratorAdd .. autoclass:: twitchio.ChannelModeratorAdd() :members: + :inherited-members: .. attributetable:: twitchio.ChannelModeratorRemove .. autoclass:: twitchio.ChannelModeratorRemove() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPointsEmote @@ -329,6 +358,7 @@ .. autoclass:: twitchio.ChannelPointsAutoRedeemAdd() :members: + :inherited-members: .. attributetable:: twitchio.CooldownSettings @@ -338,6 +368,7 @@ .. autoclass:: twitchio.ChannelPointsReward() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPointsRewardAdd @@ -358,11 +389,13 @@ .. autoclass:: twitchio.ChannelPointsRedemptionAdd() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPointsRedemptionUpdate .. autoclass:: twitchio.ChannelPointsRedemptionUpdate() :members: + :inherited-members: .. attributetable:: twitchio.PollVoting @@ -372,116 +405,139 @@ .. autoclass:: twitchio.ChannelPollBegin() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPollProgress .. autoclass:: twitchio.ChannelPollProgress() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPollEnd .. autoclass:: twitchio.ChannelPollEnd() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPredictionBegin .. autoclass:: twitchio.ChannelPredictionBegin() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPredictionProgress .. autoclass:: twitchio.ChannelPredictionProgress() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPredictionLock .. autoclass:: twitchio.ChannelPredictionLock() :members: + :inherited-members: .. attributetable:: twitchio.ChannelPredictionEnd .. autoclass:: twitchio.ChannelPredictionEnd() :members: + :inherited-members: .. attributetable:: twitchio.SuspiciousUserUpdate .. autoclass:: twitchio.SuspiciousUserUpdate() :members: + :inherited-members: .. attributetable:: twitchio.SuspiciousUserMessage .. autoclass:: twitchio.SuspiciousUserMessage() :members: + :inherited-members: .. attributetable:: twitchio.ChannelVIPAdd .. autoclass:: twitchio.ChannelVIPAdd() :members: + :inherited-members: .. attributetable:: twitchio.ChannelVIPRemove .. autoclass:: twitchio.ChannelVIPRemove() :members: + :inherited-members: .. attributetable:: twitchio.ChannelWarningAcknowledge .. autoclass:: twitchio.ChannelWarningAcknowledge() :members: + :inherited-members: .. attributetable:: twitchio.ChannelWarningSend .. autoclass:: twitchio.ChannelWarningSend() :members: + :inherited-members: .. attributetable:: twitchio.CharityCampaignDonation .. autoclass:: twitchio.CharityCampaignDonation() :members: + :inherited-members: .. attributetable:: twitchio.CharityCampaignStart .. autoclass:: twitchio.CharityCampaignStart() :members: + :inherited-members: .. attributetable:: twitchio.CharityCampaignProgress .. autoclass:: twitchio.CharityCampaignProgress() :members: + :inherited-members: .. attributetable:: twitchio.CharityCampaignStop .. autoclass:: twitchio.CharityCampaignStop() :members: + :inherited-members: .. attributetable:: twitchio.GoalBegin .. autoclass:: twitchio.GoalBegin() :members: + :inherited-members: .. attributetable:: twitchio.GoalProgress .. autoclass:: twitchio.GoalProgress() :members: + :inherited-members: .. attributetable:: twitchio.GoalEnd .. autoclass:: twitchio.GoalEnd() :members: + :inherited-members: .. attributetable:: twitchio.HypeTrainBegin .. autoclass:: twitchio.HypeTrainBegin() :members: + :inherited-members: .. attributetable:: twitchio.HypeTrainProgress .. autoclass:: twitchio.HypeTrainProgress() :members: + :inherited-members: .. attributetable:: twitchio.HypeTrainEnd .. autoclass:: twitchio.HypeTrainEnd() :members: + :inherited-members: .. attributetable:: twitchio.PowerUp @@ -497,31 +553,37 @@ .. autoclass:: twitchio.ShieldModeBegin() :members: + :inherited-members: .. attributetable:: twitchio.ShieldModeEnd .. autoclass:: twitchio.ShieldModeEnd() :members: + :inherited-members: .. attributetable:: twitchio.ShoutoutCreate .. autoclass:: twitchio.ShoutoutCreate() :members: + :inherited-members: .. attributetable:: twitchio.ShoutoutReceive .. autoclass:: twitchio.ShoutoutReceive() :members: + :inherited-members: .. attributetable:: twitchio.StreamOnline .. autoclass:: twitchio.StreamOnline() :members: + :inherited-members: .. attributetable:: twitchio.StreamOffline .. autoclass:: twitchio.StreamOffline() :members: + :inherited-members: .. attributetable:: twitchio.SubscriptionRevoked diff --git a/twitchio/client.py b/twitchio/client.py index a1895e04..3a34e00e 100644 --- a/twitchio/client.py +++ b/twitchio/client.py @@ -477,7 +477,7 @@ async def start( token: str | None An optional app token to use instead of generating one automatically. with_adapter: bool - Whether to start and run a web adapter. Defaults to `True`. See: ... for more information. + Whether to start and run a web adapter. Defaults to `True`. load_tokens: bool Optional bool which indicates whether the :class:`Client` should call :meth:`.load_tokens` during :meth:`.login` automatically. Defaults to ``True``. @@ -546,7 +546,7 @@ def run( token: str | None An optional app token to use instead of generating one automatically. with_adapter: bool - Whether to start and run a web adapter. Defaults to `True`. See: ... for more information. + Whether to start and run a web adapter. Defaults to `True`. load_tokens: bool Optional bool which indicates whether the :class:`Client` should call :meth:`.load_tokens` during :meth:`.login` automatically. Defaults to ``True``. @@ -2214,10 +2214,6 @@ async def subscribe_websocket( Subscribe to an EventSub Event via Websockets. - .. note:: - - See: ... for more information and recipes on using eventsub. - Parameters ---------- payload: :class:`twitchio.eventsub.SubscriptionPayload` @@ -2345,10 +2341,6 @@ async def subscribe_webhook( Subscribe to an EventSub Event via Webhook. - .. note:: - - For more information on how to setup your bot with webhooks, see: ... - .. important:: Usually you wouldn't use webhooks to subscribe to the diff --git a/twitchio/ext/commands/context.py b/twitchio/ext/commands/context.py index 6ed4d390..5c54ca1d 100644 --- a/twitchio/ext/commands/context.py +++ b/twitchio/ext/commands/context.py @@ -520,8 +520,6 @@ async def send(self, content: str, *, me: bool = False) -> SentMessage: then additionally requires the ``user:bot`` scope on the bot, and either ``channel:bot`` scope from the broadcaster or moderator status. - See: ... for more information. - Parameters ---------- content: str @@ -562,8 +560,6 @@ async def reply(self, content: str, *, me: bool = False) -> SentMessage: then additionally requires the ``user:bot`` scope on the bot, and either ``channel:bot`` scope from the broadcaster or moderator status. - See: ... for more information. - Parameters ---------- content: str @@ -602,7 +598,6 @@ async def send_announcement( .. important:: The broadcaster of the associated channel must have granted your bot the ``moderator:manage:announcements`` scope. - See: ... for more information. Parameters ---------- @@ -637,7 +632,6 @@ async def delete_message(self) -> None: .. important:: The broadcaster of the associated channel must have granted your bot the ``moderator:manage:chat_messages`` scope. - See: ... for more information. .. note:: @@ -664,7 +658,6 @@ async def clear_messages(self) -> None: .. important:: The broadcaster of the associated channel must have granted your bot the ``moderator:manage:chat_messages`` scope. - See: ... for more information. Raises ------ diff --git a/twitchio/models/eventsub_.py b/twitchio/models/eventsub_.py index c75b4655..0bc4a7a0 100644 --- a/twitchio/models/eventsub_.py +++ b/twitchio/models/eventsub_.py @@ -42,6 +42,7 @@ if TYPE_CHECKING: from twitchio.http import HTTPAsyncIterator, HTTPClient from twitchio.models.channel_points import CustomRewardRedemption + from twitchio.models.chat import SentMessage from twitchio.types_.conduits import ( Condition, ConduitData, @@ -259,6 +260,63 @@ def subscription_data(self) -> NotificationSubscription: return NotificationSubscription(self._sub_data) +class _ResponderEvent(BaseEvent): + broadcaster: PartialUser + _http: HTTPClient + + async def respond(self, content: str, *, me: bool = False) -> SentMessage: + """|coro| + + Helper method to respond by sending a message to the broadcasters channel this event originates from, as the bot. + + .. warning:: + + You must set the ``bot_id`` parameter on your :class:`~twitchio.Client`, :class:`~twitchio.ext.commands.Bot` or + :class:`~twitchio.ext.commands.AutoBot` for this method to work. + + .. important:: + + You must have the ``user:write:chat`` scope. If an app access token is used, + then additionally requires the ``user:bot`` scope on the bot, + and either ``channel:bot`` scope from the broadcaster or moderator status. + + .. versionadded:: 3.1 + + Parameters + ---------- + content: str + The content of the message you would like to send. This cannot exceed ``500`` characters. Additionally the content + parameter will be stripped of all leading and trailing whitespace. + me: bool + An optional bool indicating whether you would like to send this message with the ``/me`` chat command. + + Returns + ------- + SentMessage + The payload received by Twitch after sending this message. + + Raises + ------ + HTTPException + Twitch failed to process the message, could be ``400``, ``401``, ``403``, ``422`` or any ``5xx`` status code. + MessageRejectedError + Twitch rejected the message from various checks. + RuntimeError + You must provide the ``bot_id`` parameter to :class:`~twitchio.Client`, :class:`~twitchio.ext.commands.Bot` or + :class:`~twitchio.ext.commands.AutoBot` for this method to work. + """ + client = getattr(self._http, "_client", None) + if not client: + raise NotImplementedError("This method is only available with Client/Bot dispatched events.") + + bot_id = client.bot_id + if not bot_id: + raise RuntimeError(f"You must provide 'bot_id' to {client!r} to use this method.") + + new = (f"/me {content}" if me else content).strip() + return await self.broadcaster.send_message(sender=bot_id, message=new) + + def create_event_instance( event_type: str, raw_data: NotificationMessage | Any, @@ -280,6 +338,9 @@ def create_event_instance( instance._metadata = metadata instance._headers = headers + if isinstance(instance, _ResponderEvent): + instance._http = http # type: ignore + return instance @@ -465,7 +526,7 @@ def __repr__(self) -> str: return f"" -class AutomodMessageHold(BaseEvent): +class AutomodMessageHold(_ResponderEvent): """ Represents an automod message hold event. Both V1 and V2. @@ -622,7 +683,7 @@ def __repr__(self) -> str: return f"" -class AutomodSettingsUpdate(BaseEvent): +class AutomodSettingsUpdate(_ResponderEvent): """ Represents an automod settings update event. @@ -689,7 +750,7 @@ def __repr__(self) -> str: return f"" -class AutomodTermsUpdate(BaseEvent): +class AutomodTermsUpdate(_ResponderEvent): """ Represents an automod terms update event. @@ -801,7 +862,7 @@ def __init__(self, data: PowerUpData) -> None: self.message_effect_id: str | None = data.get("message_effect_id") -class ChannelBitsUse(BaseEvent): +class ChannelBitsUse(_ResponderEvent): """ Represents a channel bits use event. @@ -845,7 +906,7 @@ def __repr__(self) -> str: return f"" -class ChannelUpdate(BaseEvent): +class ChannelUpdate(_ResponderEvent): """ Represents a channel update event. @@ -883,7 +944,7 @@ def __repr__(self) -> str: return f"" -class ChannelFollow(BaseEvent): +class ChannelFollow(_ResponderEvent): """ Represents a channel follow event. @@ -912,7 +973,7 @@ def __repr__(self) -> str: return f"" -class ChannelAdBreakBegin(BaseEvent): +class ChannelAdBreakBegin(_ResponderEvent): """ Represents a channel ad break event. @@ -951,7 +1012,7 @@ def __repr__(self) -> str: ) -class ChannelChatClear(BaseEvent): +class ChannelChatClear(_ResponderEvent): """ Represents a channel chat clear event. @@ -974,7 +1035,7 @@ def __repr__(self) -> str: return f"" -class ChannelChatClearUserMessages(BaseEvent): +class ChannelChatClearUserMessages(_ResponderEvent): """ Represents a user's channel chat clear event. @@ -1211,7 +1272,7 @@ def __repr__(self) -> str: return f"" -class BaseChatMessage(BaseEvent): +class BaseChatMessage(_ResponderEvent): __slots__ = ( "broadcaster", "fragments", @@ -1748,7 +1809,7 @@ def __repr__(self) -> str: return f"" -class ChatNotification(BaseEvent): +class ChatNotification(_ResponderEvent): """ Represents a chat notification. @@ -2007,7 +2068,7 @@ def __repr__(self) -> str: return f"" -class ChatMessageDelete(BaseEvent): +class ChatMessageDelete(_ResponderEvent): """ Represents a chat message delete event. @@ -2038,7 +2099,7 @@ def __repr__(self) -> str: return f"" -class ChatSettingsUpdate(BaseEvent): +class ChatSettingsUpdate(_ResponderEvent): """ Represents a chat settings update event. @@ -2127,7 +2188,7 @@ def full_message(self) -> str: return " ".join(fragment.text for fragment in self.fragments if fragment.type == "text") -class BaseSharedChatSession(BaseEvent): +class BaseSharedChatSession(_ResponderEvent): __slots__ = ( "broadcaster", "host", @@ -2240,7 +2301,7 @@ def __repr__(self) -> str: return f"" -class ChannelSubscribe(BaseEvent): +class ChannelSubscribe(_ResponderEvent): """ Represents a channel subscribe event. @@ -2277,7 +2338,7 @@ def __repr__(self) -> str: return f"" -class ChannelSubscriptionEnd(BaseEvent): +class ChannelSubscriptionEnd(_ResponderEvent): """ Represents a channel subscription end event. @@ -2314,7 +2375,7 @@ def __repr__(self) -> str: return f"" -class ChannelSubscriptionGift(BaseEvent): +class ChannelSubscriptionGift(_ResponderEvent): """ Represents a channel subscription gift event. @@ -2391,7 +2452,7 @@ def __repr__(self) -> str: return f"" -class ChannelSubscriptionMessage(BaseEvent): +class ChannelSubscriptionMessage(_ResponderEvent): """ Represents a subscription message event. @@ -2437,7 +2498,7 @@ def __repr__(self) -> str: return f"" -class ChannelCheer(BaseEvent): +class ChannelCheer(_ResponderEvent): """ Represents a channel cheer event. @@ -2513,7 +2574,7 @@ def __repr__(self) -> str: return f"" -class ChannelBan(BaseEvent): +class ChannelBan(_ResponderEvent): """ Represents a channel ban event. @@ -2558,7 +2619,7 @@ def __repr__(self) -> str: return f"" -class ChannelUnban(BaseEvent): +class ChannelUnban(_ResponderEvent): """ Represents a channel unban event. @@ -2589,7 +2650,7 @@ def __repr__(self) -> str: return f"" -class ChannelUnbanRequest(BaseEvent): +class ChannelUnbanRequest(_ResponderEvent): """ Represents a channel unban request event. @@ -2624,7 +2685,7 @@ def __repr__(self) -> str: return f"" -class ChannelUnbanRequestResolve(BaseEvent): +class ChannelUnbanRequestResolve(_ResponderEvent): """ Represents a channel unban request resolve event. @@ -2884,7 +2945,7 @@ def __repr__(self) -> str: return f"" -class ChannelModerate(BaseEvent): +class ChannelModerate(_ResponderEvent): """ Represents a channel moderate event, both V1 and V2. @@ -3163,7 +3224,7 @@ def __init__(self, payload: ChannelModerateEvent | ChannelModerateEventV2, *, ht self.warn: ModerateWarn | None = ModerateWarn(warn, http=http) if warn is not None else None -class ChannelModeratorAdd(BaseEvent): +class ChannelModeratorAdd(_ResponderEvent): """ Represents a moderator add event. @@ -3189,7 +3250,7 @@ def __repr__(self) -> str: return f"" -class ChannelModeratorRemove(BaseEvent): +class ChannelModeratorRemove(_ResponderEvent): """ Represents a moderator remove event. @@ -3290,7 +3351,7 @@ def __repr__(self) -> str: return f"" -class ChannelPointsAutoRedeemAdd(BaseEvent): +class ChannelPointsAutoRedeemAdd(_ResponderEvent): """ Represents an automatic redemption of a channel points reward. @@ -3377,7 +3438,7 @@ class CooldownSettings(NamedTuple): seconds: int -class ChannelPointsReward(BaseEvent): +class ChannelPointsReward(_ResponderEvent): """ Represents an Eventsub Custom Reward. @@ -3703,7 +3764,7 @@ def __repr__(self) -> str: return f"" -class BaseChannelPointsRedemption(BaseEvent): +class BaseChannelPointsRedemption(_ResponderEvent): __slots__ = ("broadcaster", "id", "redeemed_at", "reward", "status", "user", "user_input") def __init__( @@ -3872,7 +3933,7 @@ class PollVoting(NamedTuple): amount: int -class BaseChannelPoll(BaseEvent): +class BaseChannelPoll(_ResponderEvent): __slots__ = ("broadcaster", "channel_points_voting", "choices", "id", "started_at", "status", "title") def __init__( @@ -4006,7 +4067,7 @@ def __repr__(self) -> str: return f"" -class BaseChannelPrediction(BaseEvent): +class BaseChannelPrediction(_ResponderEvent): def __init__( self, payload: ChannelPredictionBeginEvent @@ -4165,7 +4226,7 @@ def __repr__(self) -> str: return f"" -class SuspiciousUserUpdate(BaseEvent): +class SuspiciousUserUpdate(_ResponderEvent): """ Represents a suspicious user update event. @@ -4203,7 +4264,7 @@ def __repr__(self) -> str: return f"" -class SuspiciousUserMessage(BaseEvent): +class SuspiciousUserMessage(_ResponderEvent): """ Represents a suspicious user message event. @@ -4259,7 +4320,7 @@ def __repr__(self) -> str: return f"" -class ChannelVIPAdd(BaseEvent): +class ChannelVIPAdd(_ResponderEvent): """ Represents a channel VIP remove event. @@ -4285,7 +4346,7 @@ def __repr__(self) -> str: return f"" -class ChannelVIPRemove(BaseEvent): +class ChannelVIPRemove(_ResponderEvent): """ Represents a channel VIP remove event. @@ -4311,7 +4372,7 @@ def __repr__(self) -> str: return f"" -class ChannelWarningAcknowledge(BaseEvent): +class ChannelWarningAcknowledge(_ResponderEvent): """ Represents a channel warning acknowledge event. @@ -4337,7 +4398,7 @@ def __repr__(self) -> str: return f"" -class ChannelWarningSend(BaseEvent): +class ChannelWarningSend(_ResponderEvent): """ Represents a channel warning send event. @@ -4374,7 +4435,7 @@ def __repr__(self) -> str: return f"" -class BaseCharityCampaign(BaseEvent): +class BaseCharityCampaign(_ResponderEvent): __slots__ = ("broadcaster", "current", "description", "id", "logo", "name", "target", "website") def __init__( @@ -4399,7 +4460,7 @@ def __repr__(self) -> str: return f"" -class CharityCampaignDonation(BaseEvent): +class CharityCampaignDonation(_ResponderEvent): """ Represents a charity campaign donation event. @@ -4551,7 +4612,7 @@ def __repr__(self) -> str: return f"" -class BaseGoal(BaseEvent): +class BaseGoal(_ResponderEvent): __slots__ = ("broadcaster", "current_amount", "description", "id", "started_at", "target_amount", "type") def __init__(self, payload: GoalBeginEvent | GoalProgressEvent | GoalEndEvent, *, http: HTTPClient) -> None: @@ -4817,7 +4878,7 @@ def __repr__(self) -> str: return f"" -class BaseHypeTrain(BaseEvent): +class BaseHypeTrain(_ResponderEvent): __slots__ = ( "broadcaster", "id", @@ -5025,7 +5086,7 @@ def __repr__(self) -> str: return f"" -class ShieldModeBegin(BaseEvent): +class ShieldModeBegin(_ResponderEvent): """ Represents a shield mode begin event. @@ -5060,7 +5121,7 @@ def __repr__(self) -> str: return f"" -class ShieldModeEnd(BaseEvent): +class ShieldModeEnd(_ResponderEvent): """ Represents a shield mode end event. @@ -5095,7 +5156,7 @@ def __repr__(self) -> str: return f"" -class ShoutoutCreate(BaseEvent): +class ShoutoutCreate(_ResponderEvent): """ Represents a shoutout create event. @@ -5151,7 +5212,7 @@ def __repr__(self) -> str: return f"" -class ShoutoutReceive(BaseEvent): +class ShoutoutReceive(_ResponderEvent): """ Represents a shoutout received event. @@ -5188,7 +5249,7 @@ def __repr__(self) -> str: return f"" -class StreamOnline(BaseEvent): +class StreamOnline(_ResponderEvent): """ Represents a stream online event. @@ -5227,7 +5288,7 @@ def __repr__(self) -> str: return f"" -class StreamOffline(BaseEvent): +class StreamOffline(_ResponderEvent): """ Represents a stream offline event. diff --git a/twitchio/web/aio_adapter.py b/twitchio/web/aio_adapter.py index b7b82a84..dc9f6e63 100644 --- a/twitchio/web/aio_adapter.py +++ b/twitchio/web/aio_adapter.py @@ -246,7 +246,7 @@ async def eventsub_callback(self, request: web.Request) -> web.Response: return web.Response(status=400) if not self._eventsub_secret: - msg: str = f"Eventsub Webhook '{self!r}' must be passed a secret. See: ... for more info.'" + msg: str = f"Eventsub Webhook '{self!r}' must be passed a secret.'" return web.Response(text=msg, status=400) msg_id: str | None = headers.get("Twitch-Eventsub-Message-Id", None) diff --git a/twitchio/web/starlette_adapter.py b/twitchio/web/starlette_adapter.py index 5f0130ad..2a7d9c56 100644 --- a/twitchio/web/starlette_adapter.py +++ b/twitchio/web/starlette_adapter.py @@ -288,7 +288,7 @@ async def eventsub_callback(self, request: Request) -> Response: return Response(status_code=400) if not self._eventsub_secret: - msg: str = f"Eventsub Webhook '{self!r}' must be passed a secret. See: ... for more info.'" + msg: str = f"Eventsub Webhook '{self!r}' must be passed a secret.'" return Response(msg, status_code=400) msg_id: str | None = headers.get("Twitch-Eventsub-Message-Id", None)