import { IRCMessageTags } from "../irc/tags.mjs"; import { IRCMessageData } from "../irc/irc-message.mjs"; import { Channel, ChannelIRCMessage } from "../irc/channel-irc-message.mjs"; import { TwitchBadgesList } from "../badges.mjs"; import { Color } from "../color.mjs"; import { TwitchEmoteList } from "../emotes.mjs"; import { TwitchFlagList } from "../flags.mjs"; import { SharedChatFields, SharedChatSource } from "../shared-chat.mjs"; import { MessageSender } from "./privmsg.mjs"; //#region src/message/twitch-types/usernotice.d.ts declare function getCamelCasedName(tagKey: string): string; type EventParameters = Record; type EventParametersMaybe = Record; declare function extractEventParameters(tags: IRCMessageTags): EventParameters; interface SharesStreakSubParameters extends EventParameters { shouldShareStreak: true; streakMonths: number; streakMonthsRaw: string; } interface HiddenStreakSubParameters extends EventParameters { shouldShareStreak: false; streakMonths: 0; streakMonthsRaw: "0"; } type StreakSubParameters = SharesStreakSubParameters | HiddenStreakSubParameters; type SubEventParameters = EventParameters & StreakSubParameters & { cumulativeMonths: number; cumulativeMonthsRaw: string; subPlan: string; subPlanName: string; }; interface RaidParameters extends EventParameters { displayName: string; login: string; viewerCount: number; viewerCountRaw: string; } interface SubgiftParameters extends EventParameters { months: number; monthsRaw: string; recipientDisplayName: string; recipientId: number; recipientUsername: string; subPlan: string; subPlanName: string; } type AnonSubgiftParameters = SubgiftParameters; interface MassSubgiftParameters extends EventParameters { massGiftCount: number; subPlan: string; } type AnonGiftPaidUpgradeParameters = EventParameters & { promoGiftTotal?: number; promoGiftTotalRaw?: string; promoName?: string; }; type GiftPaidUpgradeParameters = AnonGiftPaidUpgradeParameters & { senderLogin: string; senderName: string; }; interface RitualParameters extends EventParameters { ritualName: string; } interface BitsBadgeTierParameters extends EventParameters { threshold: number; thresholdRaw: string; } interface AnnouncementParameters extends EventParametersMaybe { color?: string; } interface ViewerMilestoneParameters extends EventParameters { /** The amount of channel points the user gained for reaching this milestone. */ copoReward: number; copoRewardRaw: string; /** The value of the respective milestone category. (usually amount of viewed streams in a row, for "watch-streak") */ value: number; valueRaw: string; /** The category of the milestone. (usually "watch-streak") */ category: string; } interface SpecificUsernoticeMessage { readonly messageTypeId: I; readonly eventParams: E; } interface AnAnnouncementUsernoticeMessage { readonly messageTypeId: I; readonly eventParams: E; } type SubUsernoticeMessage = SpecificUsernoticeMessage<"sub", SubEventParameters>; type ResubUsernoticeMessage = SpecificUsernoticeMessage<"resub", SubEventParameters>; type RaidUsernoticeMessage = SpecificUsernoticeMessage<"raid", RaidParameters>; type SubgiftUsernoticeMessage = SpecificUsernoticeMessage<"subgift", SubgiftParameters>; type MassSubgiftUsernoticeMessage = SpecificUsernoticeMessage<"submysterygift", MassSubgiftParameters>; type AnonSubgiftUsernoticeMessage = SpecificUsernoticeMessage<"anonsubgift", AnonSubgiftParameters>; type AnonGiftPaidUpgradeUsernoticeMessage = SpecificUsernoticeMessage<"anongiftpaidupgrade", AnonGiftPaidUpgradeParameters>; type GiftPaidUpgradeUsernoticeMessage = SpecificUsernoticeMessage<"giftpaidupgrade", GiftPaidUpgradeParameters>; type RitualUsernoticeMessage = SpecificUsernoticeMessage<"ritual", RitualParameters>; type BitsBadgeTierUsernoticeMessage = SpecificUsernoticeMessage<"bitsbadgetier", BitsBadgeTierParameters>; type AnnouncementUsernoticeMessage = AnAnnouncementUsernoticeMessage<"announcement", AnnouncementParameters>; type ViewerMilestoneUsernoticeMessage = SpecificUsernoticeMessage<"viewermilestone", ViewerMilestoneParameters>; interface CheerUsernoticeMessage extends UsernoticeMessage { readonly bits: number; readonly bitsRaw: string; } declare class UsernoticeMessage extends ChannelIRCMessage implements Partial { private readonly _channelRoomId; private readonly _content; private readonly _systemMessage; private readonly _messageTypeId; private readonly _messageType; private readonly _senderLogin; private readonly _senderId; private readonly _badgeInfo; private readonly _badgeInfoRaw; private readonly _badges; private readonly _badgesRaw; private readonly _bits; private readonly _bitsRaw; private readonly _color; private readonly _colorRaw; private readonly _displayName; private readonly _emotes; private readonly _emotesRaw; private readonly _flags; private readonly _flagsRaw; private readonly _id; private readonly _isMod; private readonly _isModRaw; private readonly _timestamp; private readonly _timestampRaw; private readonly _eventParams; private readonly _sourceId; private readonly _sourceChannelId; private readonly _sourceBadges; private readonly _sourceBadgesRaw; private readonly _sourceBadgeInfo; private readonly _sourceBadgeInfoRaw; private readonly _sourceMessageTypeId; get content(): string | undefined; get systemMessage(): string; /** sub, resub, subgift, etc..., or the uuid of the message if its a shared chat */ get messageTypeId(): string; /** @deprecated Use {@link messageTypeId} instead. */ get messageTypeID(): string; get messageType(): string; get id(): string; /** * The timestamp of when the message was sent, as reported by Twitch. * This is not necessarily the same as the time the message was received by your client. */ get timestamp(): Date; get timestampRaw(): string; get eventParams(): EventParameters; get bits(): number | undefined; get bitsRaw(): string | undefined; get emotes(): TwitchEmoteList; get emotesRaw(): string; /** * Can be an array of Twitch AutoMod flagged words, for use in moderation and/or filtering purposes. * * If the `flags` tag is missing or of a unparseable format, this will be `undefined`. This is unlike most other * attributes which when missing or malformed will fail the message parsing. However since this attribute is * completely undocumented we cannot rely on the `flags` tag being stable, so this soft fallback is used instead. * While it will be a major version release if this attribute changes format in dank-twitch-irc, using this is still * at your own risk since it may suddenly contain unexpected data or turn `undefined` one day as * Twitch changes something. In short: **Use at your own risk** and make sure your * implementation can handle the case where this is `undefined`. */ get flags(): TwitchFlagList | undefined; /** * Twitch AutoMod raw flags string. * * If the `flags` tag is missing or of a unparseable format, this will be `undefined`. This is unlike most other * attributes which when missing or malformed will fail the message parsing. However since this attribute is * completely undocumented we cannot rely on the `flags` tag being stable, so this soft fallback is used instead. * In short, ensure your implementation can handle the case where this is `undefined` or is in * a format you don't expect. */ get flagsRaw(): string | undefined; get channel(): Channel & { readonly id: string; }; get sender(): MessageSender; get source(): SharedChatSource | undefined; get sourceMessageTypeId(): string | undefined; /** @deprecated Use {@link channel.id} instead. */ get channelID(): string; /** @deprecated Use {@link content} instead. */ get messageText(): string | undefined; /** @deprecated Use {@link sender.login} instead. */ get senderUsername(): string; /** @deprecated Use {@link sender.id} instead. */ get senderUserID(): string; /** @deprecated Use {@link sender.id} instead. */ get senderUserId(): string; /** @deprecated Use {@link sender.badgeInfo} instead. */ get badgeInfo(): TwitchBadgesList; /** @deprecated Use {@link sender.badgeInfoRaw} instead. */ get badgeInfoRaw(): string; /** @deprecated Use {@link sender.badges} instead. */ get badges(): TwitchBadgesList; /** @deprecated Use {@link sender.badgesRaw} instead. */ get badgesRaw(): string; /** @deprecated Use {@link sender.color} instead. */ get color(): Color | undefined; /** @deprecated Use {@link sender.colorRaw} instead. */ get colorRaw(): string; /** @deprecated Use {@link sender.displayName} instead. */ get displayName(): string; /** @deprecated Use {@link id} instead. */ get messageID(): string; /** @deprecated Use {@link id} instead. */ get messageId(): string; /** @deprecated Use {@link sender.isMod} instead. */ get isMod(): boolean; /** @deprecated Use {@link sender.isModRaw} instead. */ get isModRaw(): string; /** @deprecated Use {@link timestamp} instead. */ get serverTimestamp(): Date; /** @deprecated Use {@link timestampRaw} instead. */ get serverTimestampRaw(): string; /** @deprecated Use {@link source.id} instead. */ get sourceID(): string | undefined; /** @deprecated Use {@link source.channelID} instead. */ get sourceChannelID(): string | undefined; /** @deprecated Use {@link source.badges} instead. */ get sourceBadges(): TwitchBadgesList | undefined; /** @deprecated Use {@link source.badgesRaw} instead. */ get sourceBadgesRaw(): string | undefined; /** @deprecated Use {@link source.badgeInfo} instead. */ get sourceBadgesInfo(): TwitchBadgesList | undefined; /** @deprecated Use {@link source.badgeInfoRaw} instead. */ get sourceBadgesInfoRaw(): string | undefined; /** @deprecated Use {@link sourceMessageTypeId} instead. */ get sourceMessageTypeID(): string | undefined; constructor(message: IRCMessageData); isCheer(): this is CheerUsernoticeMessage; isSub(): this is SubUsernoticeMessage; isResub(): this is ResubUsernoticeMessage; isRaid(): this is RaidUsernoticeMessage; isSubgift(): this is SubgiftUsernoticeMessage; isMassSubgift(): this is MassSubgiftParameters; isAnonSubgift(): this is AnonSubgiftUsernoticeMessage; isAnonGiftPaidUpgrade(): this is AnonGiftPaidUpgradeUsernoticeMessage; isGiftPaidUpgrade(): this is GiftPaidUpgradeUsernoticeMessage; isRitual(): this is RitualUsernoticeMessage; isBitsBadgeTier(): this is BitsBadgeTierUsernoticeMessage; isAnnouncement(): this is AnnouncementUsernoticeMessage; isViewerMilestone(): this is ViewerMilestoneUsernoticeMessage; /** * Whether or not this message is during a shared chat session. * This does NOT necessarily mean that the message is originating from another channel. * Check if `message.source.channelId !== message.channel.id` for that * @see https://dev.twitch.tv/docs/chat/irc/#shared-chat */ isSharedChat(): this is this & SharedChatFields & { sourceMessageTypeId: string; }; } //#endregion export { AnAnnouncementUsernoticeMessage, AnnouncementParameters, AnnouncementUsernoticeMessage, AnonGiftPaidUpgradeParameters, AnonGiftPaidUpgradeUsernoticeMessage, AnonSubgiftParameters, AnonSubgiftUsernoticeMessage, BitsBadgeTierParameters, BitsBadgeTierUsernoticeMessage, EventParameters, EventParametersMaybe, GiftPaidUpgradeParameters, GiftPaidUpgradeUsernoticeMessage, HiddenStreakSubParameters, MassSubgiftParameters, MassSubgiftUsernoticeMessage, RaidParameters, RaidUsernoticeMessage, ResubUsernoticeMessage, RitualParameters, RitualUsernoticeMessage, SharesStreakSubParameters, SpecificUsernoticeMessage, StreakSubParameters, SubEventParameters, SubUsernoticeMessage, SubgiftParameters, SubgiftUsernoticeMessage, UsernoticeMessage, ViewerMilestoneParameters, ViewerMilestoneUsernoticeMessage, extractEventParameters, getCamelCasedName }; //# sourceMappingURL=usernotice.d.mts.map