Module: OnyxCord::Bot::Presence
- Included in:
- OnyxCord::Bot
- Defined in:
- lib/onyxcord/core/bot/presence.rb
Instance Method Summary collapse
-
#competing=(name) ⇒ String
Sets the currently competing status to the specified name.
-
#dnd ⇒ Object
Sets the bot's status to DnD (red icon).
-
#game=(name) ⇒ String
(also: #playing=)
Sets the currently playing game to the specified game.
-
#idle ⇒ Object
(also: #away)
Sets status to idle.
-
#invisible ⇒ Object
Sets the bot's status to invisible (appears offline).
-
#listening=(name) ⇒ String
Sets the current listening status to the specified name.
-
#online ⇒ Object
(also: #on)
Sets status to online.
-
#stream(name, url) ⇒ String
Sets the currently online stream to the specified name and Twitch URL.
-
#update_status(status, activity, url, since = 0, afk = false, activity_type = 0) ⇒ Object
Updates presence status.
-
#watching=(name) ⇒ String
Sets the current watching status to the specified name.
Instance Method Details
#competing=(name) ⇒ String
Sets the currently competing status to the specified name.
69 70 71 72 |
# File 'lib/onyxcord/core/bot/presence.rb', line 69 def competing=(name) gateway_check update_status(@status, name, nil, nil, nil, 5) end |
#dnd ⇒ Object
Sets the bot's status to DnD (red icon).
91 92 93 94 |
# File 'lib/onyxcord/core/bot/presence.rb', line 91 def dnd gateway_check update_status(:dnd, @activity, nil) end |
#game=(name) ⇒ String Also known as: playing=
Sets the currently playing game to the specified game.
33 34 35 36 |
# File 'lib/onyxcord/core/bot/presence.rb', line 33 def game=(name) gateway_check update_status(@status, name, nil) end |
#idle ⇒ Object Also known as: away
Sets status to idle.
83 84 85 86 |
# File 'lib/onyxcord/core/bot/presence.rb', line 83 def idle gateway_check update_status(:idle, @activity, nil) end |
#invisible ⇒ Object
Sets the bot's status to invisible (appears offline).
97 98 99 100 |
# File 'lib/onyxcord/core/bot/presence.rb', line 97 def invisible gateway_check update_status(:invisible, @activity, nil) end |
#listening=(name) ⇒ String
Sets the current listening status to the specified name.
43 44 45 46 |
# File 'lib/onyxcord/core/bot/presence.rb', line 43 def listening=(name) gateway_check update_status(@status, name, nil, nil, nil, 2) end |
#online ⇒ Object Also known as: on
Sets status to online.
75 76 77 78 |
# File 'lib/onyxcord/core/bot/presence.rb', line 75 def online gateway_check update_status(:online, @activity, @streamurl) end |
#stream(name, url) ⇒ String
Sets the currently online stream to the specified name and Twitch URL.
60 61 62 63 64 |
# File 'lib/onyxcord/core/bot/presence.rb', line 60 def stream(name, url) gateway_check update_status(@status, name, url) name end |
#update_status(status, activity, url, since = 0, afk = false, activity_type = 0) ⇒ Object
Updates presence status.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/onyxcord/core/bot/presence.rb', line 15 def update_status(status, activity, url, since = 0, afk = false, activity_type = 0) gateway_check @activity = activity @status = status @streamurl = url type = url ? 1 : activity_type activity_obj = activity || url ? { 'name' => activity, 'url' => url, 'type' => type } : nil @gateway.send_status_update(status, since, activity_obj, afk) # Update the status in the cache profile.update_presence('status' => status.to_s, 'activities' => [activity_obj].compact) end |
#watching=(name) ⇒ String
Sets the current watching status to the specified name.
51 52 53 54 |
# File 'lib/onyxcord/core/bot/presence.rb', line 51 def watching=(name) gateway_check update_status(@status, name, nil, nil, nil, 3) end |