Constructor
new DiscordNotification(notification_data, chat_id)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
notification_data |
ChannelSubscriber.DiscordNotificationData | Channel state data from discord |
chat_id |
string | Telegram chat id |
Members
channel_id :string
- Description:
Discord channel id
- Source:
Discord channel id
Type:
- string
channel_name :string
- Description:
Discord channel name
- Source:
Discord channel name
Type:
- string
channel_url :string
- Description:
Current discord channel url
- Source:
Current discord channel url
Type:
- string
chat_id :string
- Description:
Telegram chat id
- Source:
Telegram chat id
Type:
- string
cooldown_duration :number
- Description:
The time it takes to cooldown from update
- Source:
The time it takes to cooldown from update
Type:
- number
cooldown_timeout :number
- Description:
The time when the current cooldown will finnish (or has finished)
- Source:
The time when the current cooldown will finnish (or has finished)
Type:
- number
cooldown_timer :NodeJS.Timeout
- Description:
Timer controlling the state of the cooldown
- Source:
Timer controlling the state of the cooldown
Type:
- NodeJS.Timeout
current_message_id :string
- Description:
Telegram message id for the currently posted notification
- Source:
Telegram message id for the currently posted notification
Type:
- string
(nullable) current_notification_data :ChannelSubscriber.DiscordNotificationData
- Description:
The source of the currently (or about to be) posted notification
- Source:
The source of the currently (or about to be) posted notification
Type:
guild_id :string
- Description:
Discord server id
- Source:
Discord server id
Type:
- string
guild_name :string
- Description:
Discord name id
- Source:
Discord name id
Type:
- string
members :Array.<object>
- Description:
Array of members of the discord channel
- Source:
Array of members of the discord channel
Type:
- Array.<object>
pending_notification_data :ChannelSubscriber.DiscordNotificationData
- Description:
The source for the next notification update that will be applied after the cooldown
- Source:
The source for the next notification update that will be applied after the cooldown
Type:
pending_notification_data_timer :NodeJS.Timeout
- Description:
Scheduling timer that will update the notification message once it fires
- Source:
Scheduling timer that will update the notification message once it fires
Type:
- NodeJS.Timeout
Methods
clear() → {string}
- Description:
Clear all the timers and notification data
- Source:
Returns:
Last current_message_id
- Type
- string
dropPendingNotification()
- Description:
Clear current pending_notification_data and pending_notification_data_timer
- Source:
generateNotificationTextFrom(notification_data) → {string}
- Description:
Generate message text from notification data
- Source:
Parameters:
Name | Type | Description |
---|---|---|
notification_data |
ChannelSubscriber.DiscordNotificationData | Source notification data for text |
Returns:
Message text
- Type
- string
getChannelUrl(notification_data, type) → {string}
- Description:
Get discord channel url
- Source:
Parameters:
Name | Type | Description |
---|---|---|
notification_data |
ChannelSubscriber.DiscordNotificationData | Source notification data to get url from |
type |
'a' | 'b' | null | Type of a URL to get, 'a' - to app, 'b' - to browser, anything else for redirect page |
Returns:
Returns url (may be changed to support application redirect)
- Type
- string
getLogMeta() → {object}
- Description:
Get additional logging info
- Source:
Returns:
Object containing info about this DiscordNotificationData
- Type
- object
getNotificationKeyboard()
- Description:
Get keyboard for the message with channel url
- Source:
Returns:
getNotificationText() → {string}
- Description:
Get message text for current_notification_data
- Source:
Returns:
Message text
- Type
- string
getPendingNotificationText() → {string}
- Description:
Get message text for pending_notification_data
- Source:
Returns:
Pending message text
- Type
- string
isCooldownActive() → {boolean}
- Description:
Returns
true
if the cooldown is active
- Source:
Returns:
- Type
- boolean
isNotified() → {boolean}
- Description:
Returns
true
if the notification is posted
- Source:
Returns:
- Type
- boolean
startCooldownTimer()
- Description:
Resets cooldown_timer
- Source:
suspendNotification(notification_data, callback)
- Description:
Schedule message update after cooldown
- Source:
Parameters:
Name | Type | Description |
---|---|---|
notification_data |
ChannelSubscriber.DiscordNotificationData | new pending_notification_data |
callback |
transformStatus(params)
- Description:
Transform statuses to string with emojis
- Source:
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object |
Properties
|
update(notification_data)
- Description:
Sets the new current notification data and resets the cooldown timer
- Source:
Parameters:
Name | Type | Description |
---|---|---|
notification_data |
ChannelSubscriber.DiscordNotificationData | New notification data |