onyxcord 2.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/onyxcord/application_commands/command.rb +4 -97
- data/lib/onyxcord/application_commands/context.rb +4 -94
- data/lib/onyxcord/application_commands/option.rb +4 -75
- data/lib/onyxcord/application_commands/registry.rb +4 -45
- data/lib/onyxcord/application_commands.rb +8 -5
- data/lib/onyxcord/bot.rb +24 -1759
- data/lib/onyxcord/{cache.rb → cache/manager.rb} +16 -14
- data/lib/onyxcord/cache/stores/gateway.rb +272 -0
- data/lib/onyxcord/commands/bot/channels.rb +48 -0
- data/lib/onyxcord/commands/bot/execution.rb +174 -0
- data/lib/onyxcord/commands/bot/message_dispatch.rb +58 -0
- data/lib/onyxcord/commands/bot/permissions.rb +72 -0
- data/lib/onyxcord/commands/bot.rb +209 -0
- data/lib/onyxcord/commands/container.rb +21 -2
- data/lib/onyxcord/commands/parser.rb +30 -1
- data/lib/onyxcord/container.rb +16 -960
- data/lib/onyxcord/core/bot/application_commands.rb +210 -0
- data/lib/onyxcord/core/bot/awaits.rb +112 -0
- data/lib/onyxcord/core/bot/invites.rb +42 -0
- data/lib/onyxcord/core/bot/messaging.rb +161 -0
- data/lib/onyxcord/core/bot/oauth.rb +27 -0
- data/lib/onyxcord/core/bot/presence.rb +103 -0
- data/lib/onyxcord/core/bot/runtime.rb +183 -0
- data/lib/onyxcord/core/bot/voice.rb +69 -0
- data/lib/onyxcord/{logger.rb → core/logger.rb} +5 -0
- data/lib/onyxcord/core/version.rb +5 -0
- data/lib/onyxcord/events/await/base.rb +48 -0
- data/lib/onyxcord/events/await.rb +1 -46
- data/lib/onyxcord/events/ban/base.rb +54 -0
- data/lib/onyxcord/events/ban/remove.rb +11 -0
- data/lib/onyxcord/events/bans.rb +2 -58
- data/lib/onyxcord/events/channels/base.rb +91 -0
- data/lib/onyxcord/events/channels/delete.rb +73 -0
- data/lib/onyxcord/events/channels/pins.rb +44 -0
- data/lib/onyxcord/events/channels/recipients.rb +77 -0
- data/lib/onyxcord/events/channels.rb +4 -239
- data/lib/onyxcord/events/guilds/audit_logs.rb +79 -0
- data/lib/onyxcord/events/guilds/base.rb +97 -0
- data/lib/onyxcord/events/guilds/emoji.rb +147 -0
- data/lib/onyxcord/events/guilds.rb +3 -267
- data/lib/onyxcord/events/handlers/channels.rb +133 -0
- data/lib/onyxcord/events/handlers/core.rb +146 -0
- data/lib/onyxcord/events/handlers/guilds.rb +375 -0
- data/lib/onyxcord/events/handlers/interactions.rb +238 -0
- data/lib/onyxcord/events/handlers/lifetime.rb +71 -0
- data/lib/onyxcord/events/handlers/messages.rb +218 -0
- data/lib/onyxcord/events/handlers/presence.rb +56 -0
- data/lib/onyxcord/events/handlers/raw.rb +39 -0
- data/lib/onyxcord/events/handlers/reactions.rb +98 -0
- data/lib/onyxcord/events/handlers/scheduled_events.rb +243 -0
- data/lib/onyxcord/events/handlers/voice.rb +46 -0
- data/lib/onyxcord/events/integration/base.rb +45 -0
- data/lib/onyxcord/events/integration/create.rb +11 -0
- data/lib/onyxcord/events/integration/delete.rb +48 -0
- data/lib/onyxcord/events/integration/update.rb +11 -0
- data/lib/onyxcord/events/integrations.rb +4 -98
- data/lib/onyxcord/events/interactions/application_commands.rb +185 -0
- data/lib/onyxcord/events/interactions/autocomplete.rb +62 -0
- data/lib/onyxcord/events/interactions/base.rb +175 -0
- data/lib/onyxcord/events/interactions/components.rb +221 -0
- data/lib/onyxcord/events/interactions/permissions.rb +53 -0
- data/lib/onyxcord/events/interactions.rb +5 -622
- data/lib/onyxcord/events/invite/create.rb +79 -0
- data/lib/onyxcord/events/invite/delete.rb +55 -0
- data/lib/onyxcord/events/invites.rb +2 -125
- data/lib/onyxcord/events/lifetime/base.rb +31 -0
- data/lib/onyxcord/events/lifetime.rb +1 -29
- data/lib/onyxcord/events/member/add.rb +12 -0
- data/lib/onyxcord/events/member/base.rb +67 -0
- data/lib/onyxcord/events/member/delete.rb +21 -0
- data/lib/onyxcord/events/member/update.rb +25 -0
- data/lib/onyxcord/events/members.rb +4 -108
- data/lib/onyxcord/events/message/base.rb +295 -0
- data/lib/onyxcord/events/message/ids.rb +71 -0
- data/lib/onyxcord/events/message/mentions.rb +55 -0
- data/lib/onyxcord/events/message/updates.rb +27 -0
- data/lib/onyxcord/events/message.rb +4 -397
- data/lib/onyxcord/events/poll/add.rb +11 -0
- data/lib/onyxcord/events/poll/base.rb +106 -0
- data/lib/onyxcord/events/poll/remove.rb +11 -0
- data/lib/onyxcord/events/polls.rb +3 -116
- data/lib/onyxcord/events/presence/playing.rb +77 -0
- data/lib/onyxcord/events/presence/status.rb +60 -0
- data/lib/onyxcord/events/presence.rb +2 -129
- data/lib/onyxcord/events/raw/base.rb +74 -0
- data/lib/onyxcord/events/raw.rb +1 -72
- data/lib/onyxcord/events/reactions/base.rb +143 -0
- data/lib/onyxcord/events/reactions/clear.rb +99 -0
- data/lib/onyxcord/events/reactions.rb +2 -216
- data/lib/onyxcord/events/role/create.rb +46 -0
- data/lib/onyxcord/events/role/delete.rb +40 -0
- data/lib/onyxcord/events/role/update.rb +11 -0
- data/lib/onyxcord/events/roles.rb +3 -85
- data/lib/onyxcord/events/scheduled_events/events.rb +112 -0
- data/lib/onyxcord/events/scheduled_events/users.rb +91 -0
- data/lib/onyxcord/events/scheduled_events.rb +2 -169
- data/lib/onyxcord/events/thread/base.rb +49 -0
- data/lib/onyxcord/events/thread/members.rb +44 -0
- data/lib/onyxcord/events/thread/update.rb +18 -0
- data/lib/onyxcord/events/threads.rb +3 -98
- data/lib/onyxcord/events/typing/base.rb +73 -0
- data/lib/onyxcord/events/typing.rb +1 -71
- data/lib/onyxcord/events/voice/server_update.rb +48 -0
- data/lib/onyxcord/events/voice/state_update.rb +137 -0
- data/lib/onyxcord/events/voice_server_update.rb +2 -46
- data/lib/onyxcord/events/voice_state_update.rb +2 -135
- data/lib/onyxcord/events/webhook/update.rb +65 -0
- data/lib/onyxcord/events/webhooks.rb +1 -63
- data/lib/onyxcord/gateway/client.rb +460 -0
- data/lib/onyxcord/interactions/command.rb +120 -0
- data/lib/onyxcord/interactions/context.rb +109 -0
- data/lib/onyxcord/interactions/internal/application_command.rb +203 -0
- data/lib/onyxcord/interactions/internal/message.rb +152 -0
- data/lib/onyxcord/interactions/internal/metadata.rb +109 -0
- data/lib/onyxcord/interactions/internal/option_builder.rb +230 -0
- data/lib/onyxcord/interactions/internal/permission_builder.rb +90 -0
- data/lib/onyxcord/interactions/option.rb +88 -0
- data/lib/onyxcord/interactions/registry.rb +50 -0
- data/lib/onyxcord/interactions.rb +16 -0
- data/lib/onyxcord/internal/async_runtime.rb +32 -0
- data/lib/onyxcord/internal/event_bus.rb +591 -0
- data/lib/onyxcord/internal/event_executor.rb +155 -0
- data/lib/onyxcord/internal/gateway/opcodes.rb +22 -0
- data/lib/onyxcord/internal/gateway/session.rb +45 -0
- data/lib/onyxcord/internal/http.rb +189 -0
- data/lib/onyxcord/internal/json.rb +51 -0
- data/lib/onyxcord/{message_payload.rb → internal/message_payload.rb} +3 -3
- data/lib/onyxcord/internal/rate_limiter/async_rest.rb +151 -0
- data/lib/onyxcord/internal/rate_limiter/gateway.rb +44 -0
- data/lib/onyxcord/internal/rate_limiter/rest.rb +144 -0
- data/lib/onyxcord/internal/websocket.rb +79 -0
- data/lib/onyxcord/light/data.rb +1 -1
- data/lib/onyxcord/light/integrations.rb +1 -1
- data/lib/onyxcord/light/light_bot.rb +7 -7
- data/lib/onyxcord/{data → models}/activity.rb +2 -2
- data/lib/onyxcord/{data → models}/application.rb +3 -3
- data/lib/onyxcord/{data → models}/avatar_decoration.rb +1 -1
- data/lib/onyxcord/{data → models}/channel.rb +23 -23
- data/lib/onyxcord/{data → models}/collectibles.rb +1 -1
- data/lib/onyxcord/{data → models}/emoji.rb +1 -1
- data/lib/onyxcord/models/interaction.rb +450 -0
- data/lib/onyxcord/{data → models}/invite.rb +1 -1
- data/lib/onyxcord/{data → models}/member.rb +11 -11
- data/lib/onyxcord/{data → models}/message.rb +18 -14
- data/lib/onyxcord/{data → models}/poll.rb +2 -2
- data/lib/onyxcord/{data → models}/primary_server.rb +1 -1
- data/lib/onyxcord/{data → models}/profile.rb +4 -4
- data/lib/onyxcord/{data → models}/role.rb +6 -12
- data/lib/onyxcord/{data → models}/scheduled_event.rb +5 -5
- data/lib/onyxcord/{data → models}/server.rb +41 -41
- data/lib/onyxcord/{data → models}/server_preview.rb +2 -2
- data/lib/onyxcord/{data → models}/team.rb +1 -1
- data/lib/onyxcord/{data → models}/user.rb +5 -5
- data/lib/onyxcord/{data → models}/webhook.rb +10 -10
- data/lib/onyxcord/models.rb +57 -0
- data/lib/onyxcord/{api.rb → rest/client.rb} +23 -22
- data/lib/onyxcord/{api → rest/routes}/application.rb +79 -57
- data/lib/onyxcord/rest/routes/channel/base.rb +73 -0
- data/lib/onyxcord/rest/routes/channel/groups.rb +78 -0
- data/lib/onyxcord/rest/routes/channel/messages.rb +130 -0
- data/lib/onyxcord/rest/routes/channel/permissions.rb +73 -0
- data/lib/onyxcord/rest/routes/channel/pins.rb +45 -0
- data/lib/onyxcord/rest/routes/channel/polls.rb +32 -0
- data/lib/onyxcord/rest/routes/channel/reactions.rb +86 -0
- data/lib/onyxcord/rest/routes/channel/threads.rb +176 -0
- data/lib/onyxcord/rest/routes/channel/webhooks.rb +47 -0
- data/lib/onyxcord/rest/routes/channel.rb +12 -0
- data/lib/onyxcord/{api/interaction.rb → rest/routes/interaction/base.rb} +7 -25
- data/lib/onyxcord/rest/routes/interaction/response.rb +24 -0
- data/lib/onyxcord/rest/routes/interaction.rb +4 -0
- data/lib/onyxcord/{api → rest/routes}/invite.rb +7 -7
- data/lib/onyxcord/rest/routes/server/admin.rb +174 -0
- data/lib/onyxcord/rest/routes/server/assets.rb +25 -0
- data/lib/onyxcord/rest/routes/server/bans.rb +67 -0
- data/lib/onyxcord/rest/routes/server/base.rb +77 -0
- data/lib/onyxcord/rest/routes/server/channels.rb +58 -0
- data/lib/onyxcord/rest/routes/server/emoji.rb +48 -0
- data/lib/onyxcord/rest/routes/server/members.rb +109 -0
- data/lib/onyxcord/rest/routes/server/messages.rb +19 -0
- data/lib/onyxcord/rest/routes/server/roles.rb +156 -0
- data/lib/onyxcord/rest/routes/server/scheduled_events.rb +86 -0
- data/lib/onyxcord/rest/routes/server.rb +12 -0
- data/lib/onyxcord/{api → rest/routes}/user.rb +23 -23
- data/lib/onyxcord/{api → rest/routes}/webhook.rb +22 -22
- data/lib/onyxcord/{allowed_mentions.rb → utils/allowed_mentions.rb} +1 -1
- data/lib/onyxcord/utils/timestamp.rb +69 -0
- data/lib/onyxcord/voice/{voice_bot.rb → client.rb} +4 -4
- data/lib/onyxcord/voice/encoder.rb +1 -1
- data/lib/onyxcord/voice/network/udp.rb +135 -0
- data/lib/onyxcord/voice/network/websocket.rb +225 -0
- data/lib/onyxcord/voice/network.rb +5 -357
- data/lib/onyxcord/webhooks/builder.rb +1 -1
- data/lib/onyxcord/webhooks/client.rb +13 -13
- data/lib/onyxcord/webhooks/modal/group_builder.rb +55 -0
- data/lib/onyxcord/webhooks/modal/label_builder.rb +183 -0
- data/lib/onyxcord/webhooks/modal.rb +2 -239
- data/lib/onyxcord/webhooks/version.rb +3 -3
- data/lib/onyxcord/webhooks/view/container_builder.rb +80 -0
- data/lib/onyxcord/webhooks/view/file_builder.rb +24 -0
- data/lib/onyxcord/webhooks/view/media_gallery_builder.rb +50 -0
- data/lib/onyxcord/webhooks/view/row_builder.rb +120 -0
- data/lib/onyxcord/webhooks/view/section_builder.rb +61 -0
- data/lib/onyxcord/webhooks/view/select_menu_builder.rb +77 -0
- data/lib/onyxcord/webhooks/view/separator_builder.rb +22 -0
- data/lib/onyxcord/webhooks/view/text_display_builder.rb +20 -0
- data/lib/onyxcord/webhooks/view.rb +9 -425
- data/lib/onyxcord.rb +106 -42
- metadata +207 -92
- data/.github/CONTRIBUTING.md +0 -13
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
- data/.github/pull_request_template.md +0 -37
- data/.github/workflows/ci.yml +0 -78
- data/.github/workflows/codeql.yml +0 -65
- data/.github/workflows/deploy.yml +0 -54
- data/.github/workflows/release.yml +0 -51
- data/.gitignore +0 -17
- data/.markdownlint.json +0 -4
- data/.overcommit.yml +0 -7
- data/.rspec +0 -2
- data/.rubocop.yml +0 -129
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -257
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -21
- data/README.md +0 -448
- data/Rakefile +0 -13
- data/lib/onyxcord/api/channel.rb +0 -703
- data/lib/onyxcord/api/server.rb +0 -775
- data/lib/onyxcord/async/runtime.rb +0 -30
- data/lib/onyxcord/commands/command_bot.rb +0 -505
- data/lib/onyxcord/data/interaction.rb +0 -1151
- data/lib/onyxcord/data.rb +0 -57
- data/lib/onyxcord/event_executor.rb +0 -153
- data/lib/onyxcord/gateway.rb +0 -505
- data/lib/onyxcord/http.rb +0 -186
- data/lib/onyxcord/json.rb +0 -49
- data/lib/onyxcord/rate_limiter/async_rest.rb +0 -150
- data/lib/onyxcord/rate_limiter/gateway.rb +0 -42
- data/lib/onyxcord/rate_limiter/rest.rb +0 -142
- data/lib/onyxcord/version.rb +0 -7
- data/lib/onyxcord/websocket.rb +0 -77
- data/onyxcord.gemspec +0 -63
- /data/lib/onyxcord/{configuration.rb → core/configuration.rb} +0 -0
- /data/lib/onyxcord/{errors.rb → core/errors.rb} +0 -0
- /data/lib/onyxcord/{upload.rb → internal/upload.rb} +0 -0
- /data/lib/onyxcord/{data → models}/attachment.rb +0 -0
- /data/lib/onyxcord/{data → models}/audit_logs.rb +0 -0
- /data/lib/onyxcord/{data → models}/call.rb +0 -0
- /data/lib/onyxcord/{data → models}/channel_tag.rb +0 -0
- /data/lib/onyxcord/{data → models}/component.rb +0 -0
- /data/lib/onyxcord/{data → models}/embed.rb +0 -0
- /data/lib/onyxcord/{data → models}/install_params.rb +0 -0
- /data/lib/onyxcord/{data → models}/integration.rb +0 -0
- /data/lib/onyxcord/{data → models}/message_activity.rb +0 -0
- /data/lib/onyxcord/{data → models}/overwrite.rb +0 -0
- /data/lib/onyxcord/{data → models}/reaction.rb +0 -0
- /data/lib/onyxcord/{data → models}/recipient.rb +0 -0
- /data/lib/onyxcord/{data → models}/role_connection_data.rb +0 -0
- /data/lib/onyxcord/{data → models}/role_subscription.rb +0 -0
- /data/lib/onyxcord/{data → models}/snapshot.rb +0 -0
- /data/lib/onyxcord/{data → models}/timestamp.rb +0 -0
- /data/lib/onyxcord/{data → models}/voice_region.rb +0 -0
- /data/lib/onyxcord/{data → models}/voice_state.rb +0 -0
- /data/lib/onyxcord/{colour_rgb.rb → utils/colour_rgb.rb} +0 -0
- /data/lib/onyxcord/{id_object.rb → utils/id_object.rb} +0 -0
- /data/lib/onyxcord/{message_components.rb → utils/message_components.rb} +0 -0
- /data/lib/onyxcord/{paginator.rb → utils/paginator.rb} +0 -0
- /data/lib/onyxcord/{permissions.rb → utils/permissions.rb} +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnyxCord
|
|
4
|
+
module EventContainer
|
|
5
|
+
# This **event** is raised when the READY packet is received, i.e. servers and channels have finished
|
|
6
|
+
# initialization. It's the recommended way to do things when the bot has finished starting up.
|
|
7
|
+
# @param attributes [Hash] Event attributes, none in this particular case
|
|
8
|
+
# @yield The block is executed when the event is raised.
|
|
9
|
+
# @yieldparam event [ReadyEvent] The event that was raised.
|
|
10
|
+
# @return [ReadyEventHandler] the event handler that was registered.
|
|
11
|
+
def ready(attributes = {}, &block)
|
|
12
|
+
register_event(ReadyEvent, attributes, block)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# This **event** is raised when the bot has disconnected from the WebSocket, due to the {Bot#stop} method or
|
|
16
|
+
# external causes. It's the recommended way to do clean-up tasks.
|
|
17
|
+
# @param attributes [Hash] Event attributes, none in this particular case
|
|
18
|
+
# @yield The block is executed when the event is raised.
|
|
19
|
+
# @yieldparam event [DisconnectEvent] The event that was raised.
|
|
20
|
+
# @return [DisconnectEventHandler] the event handler that was registered.
|
|
21
|
+
|
|
22
|
+
# This **event** is raised when the bot has disconnected from the WebSocket, due to the {Bot#stop} method or
|
|
23
|
+
# external causes. It's the recommended way to do clean-up tasks.
|
|
24
|
+
# @param attributes [Hash] Event attributes, none in this particular case
|
|
25
|
+
# @yield The block is executed when the event is raised.
|
|
26
|
+
# @yieldparam event [DisconnectEvent] The event that was raised.
|
|
27
|
+
# @return [DisconnectEventHandler] the event handler that was registered.
|
|
28
|
+
def disconnected(attributes = {}, &block)
|
|
29
|
+
register_event(DisconnectEvent, attributes, block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# This **event** is raised every time the bot sends a heartbeat over the galaxy. This happens roughly every 40
|
|
33
|
+
# seconds, but may happen at a lower rate should Discord change their interval. It may also happen more quickly for
|
|
34
|
+
# periods of time, especially for unstable connections, since onyxcord rather sends a heartbeat than not if there's
|
|
35
|
+
# a choice. (You shouldn't rely on all this to be accurately timed.)
|
|
36
|
+
#
|
|
37
|
+
# All this makes this event useful to periodically trigger something, like doing some API request every hour,
|
|
38
|
+
# setting some kind of uptime variable or whatever else. The only limit is yourself.
|
|
39
|
+
# @param attributes [Hash] Event attributes, none in this particular case
|
|
40
|
+
# @yield The block is executed when the event is raised.
|
|
41
|
+
# @yieldparam event [HeartbeatEvent] The event that was raised.
|
|
42
|
+
# @return [HeartbeatEventHandler] the event handler that was registered.
|
|
43
|
+
|
|
44
|
+
# This **event** is raised every time the bot sends a heartbeat over the galaxy. This happens roughly every 40
|
|
45
|
+
# seconds, but may happen at a lower rate should Discord change their interval. It may also happen more quickly for
|
|
46
|
+
# periods of time, especially for unstable connections, since onyxcord rather sends a heartbeat than not if there's
|
|
47
|
+
# a choice. (You shouldn't rely on all this to be accurately timed.)
|
|
48
|
+
#
|
|
49
|
+
# All this makes this event useful to periodically trigger something, like doing some API request every hour,
|
|
50
|
+
# setting some kind of uptime variable or whatever else. The only limit is yourself.
|
|
51
|
+
# @param attributes [Hash] Event attributes, none in this particular case
|
|
52
|
+
# @yield The block is executed when the event is raised.
|
|
53
|
+
# @yieldparam event [HeartbeatEvent] The event that was raised.
|
|
54
|
+
# @return [HeartbeatEventHandler] the event handler that was registered.
|
|
55
|
+
def heartbeat(attributes = {}, &block)
|
|
56
|
+
register_event(HeartbeatEvent, attributes, block)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# This **event** is raised when somebody starts typing in a channel the bot is also in. The official Discord
|
|
60
|
+
# client would display the typing indicator for five seconds after receiving this event. If the user continues
|
|
61
|
+
# typing after five seconds, the event will be re-raised.
|
|
62
|
+
# @param attributes [Hash] The event's attributes.
|
|
63
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel where typing was started.
|
|
64
|
+
# @option attributes [String, Integer, User] :from Matches the user that started typing.
|
|
65
|
+
# @option attributes [Time] :after Matches a time after the time the typing started.
|
|
66
|
+
# @option attributes [Time] :before Matches a time before the time the typing started.
|
|
67
|
+
# @yield The block is executed when the event is raised.
|
|
68
|
+
# @yieldparam event [TypingEvent] The event that was raised.
|
|
69
|
+
# @return [TypingEventHandler] the event handler that was registered.
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnyxCord
|
|
4
|
+
module EventContainer
|
|
5
|
+
# This **event** is raised when a message is sent to a text channel the bot is currently in.
|
|
6
|
+
# @param attributes [Hash] The event's attributes.
|
|
7
|
+
# @option attributes [String, Regexp] :start_with Matches the string the message starts with.
|
|
8
|
+
# @option attributes [String, Regexp] :end_with Matches the string the message ends with.
|
|
9
|
+
# @option attributes [String, Regexp] :contains Matches a string the message contains.
|
|
10
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was sent in.
|
|
11
|
+
# @option attributes [String, Integer, User] :from Matches the user that sent the message.
|
|
12
|
+
# @option attributes [String] :content Exactly matches the entire content of the message.
|
|
13
|
+
# @option attributes [Time] :after Matches a time after the time the message was sent at.
|
|
14
|
+
# @option attributes [Time] :before Matches a time before the time the message was sent at.
|
|
15
|
+
# @option attributes [Boolean] :private Matches whether or not the channel is private.
|
|
16
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was sent.
|
|
17
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was sent in.
|
|
18
|
+
# @yield The block is executed when the event is raised.
|
|
19
|
+
# @yieldparam event [MessageEvent] The event that was raised.
|
|
20
|
+
# @return [MessageEventHandler] the event handler that was registered.
|
|
21
|
+
def message(attributes = {}, &block)
|
|
22
|
+
register_event(MessageEvent, attributes, block)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# This **event** is raised when the READY packet is received, i.e. servers and channels have finished
|
|
26
|
+
# initialization. It's the recommended way to do things when the bot has finished starting up.
|
|
27
|
+
# @param attributes [Hash] Event attributes, none in this particular case
|
|
28
|
+
# @yield The block is executed when the event is raised.
|
|
29
|
+
# @yieldparam event [ReadyEvent] The event that was raised.
|
|
30
|
+
# @return [ReadyEventHandler] the event handler that was registered.
|
|
31
|
+
|
|
32
|
+
# This **event** is raised when somebody starts typing in a channel the bot is also in. The official Discord
|
|
33
|
+
# client would display the typing indicator for five seconds after receiving this event. If the user continues
|
|
34
|
+
# typing after five seconds, the event will be re-raised.
|
|
35
|
+
# @param attributes [Hash] The event's attributes.
|
|
36
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel where typing was started.
|
|
37
|
+
# @option attributes [String, Integer, User] :from Matches the user that started typing.
|
|
38
|
+
# @option attributes [Time] :after Matches a time after the time the typing started.
|
|
39
|
+
# @option attributes [Time] :before Matches a time before the time the typing started.
|
|
40
|
+
# @yield The block is executed when the event is raised.
|
|
41
|
+
# @yieldparam event [TypingEvent] The event that was raised.
|
|
42
|
+
# @return [TypingEventHandler] the event handler that was registered.
|
|
43
|
+
def typing(attributes = {}, &block)
|
|
44
|
+
register_event(TypingEvent, attributes, block)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# This **event** is raised when a message is edited in a channel.
|
|
48
|
+
# @param attributes [Hash] The event's attributes.
|
|
49
|
+
# @option attributes [String, Integer] :id Matches the ID of the message that was edited.
|
|
50
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was edited in.
|
|
51
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was edited.
|
|
52
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was edited in.
|
|
53
|
+
# @yield The block is executed when the event is raised.
|
|
54
|
+
# @yieldparam event [MessageEditEvent] The event that was raised.
|
|
55
|
+
# @return [MessageEditEventHandler] the event handler that was registered.
|
|
56
|
+
|
|
57
|
+
# This **event** is raised when a message is edited in a channel.
|
|
58
|
+
# @param attributes [Hash] The event's attributes.
|
|
59
|
+
# @option attributes [String, Integer] :id Matches the ID of the message that was edited.
|
|
60
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was edited in.
|
|
61
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was edited.
|
|
62
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was edited in.
|
|
63
|
+
# @yield The block is executed when the event is raised.
|
|
64
|
+
# @yieldparam event [MessageEditEvent] The event that was raised.
|
|
65
|
+
# @return [MessageEditEventHandler] the event handler that was registered.
|
|
66
|
+
def message_edit(attributes = {}, &block)
|
|
67
|
+
register_event(MessageEditEvent, attributes, block)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# This **event** is raised when a message is deleted in a channel.
|
|
71
|
+
# @param attributes [Hash] The event's attributes.
|
|
72
|
+
# @option attributes [String, Integer] :id Matches the ID of the message that was deleted.
|
|
73
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was deleted in.
|
|
74
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was deleted in.
|
|
75
|
+
# @yield The block is executed when the event is raised.
|
|
76
|
+
# @yieldparam event [MessageDeleteEvent] The event that was raised.
|
|
77
|
+
# @return [MessageDeleteEventHandler] the event handler that was registered.
|
|
78
|
+
|
|
79
|
+
# This **event** is raised when a message is deleted in a channel.
|
|
80
|
+
# @param attributes [Hash] The event's attributes.
|
|
81
|
+
# @option attributes [String, Integer] :id Matches the ID of the message that was deleted.
|
|
82
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was deleted in.
|
|
83
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was deleted in.
|
|
84
|
+
# @yield The block is executed when the event is raised.
|
|
85
|
+
# @yieldparam event [MessageDeleteEvent] The event that was raised.
|
|
86
|
+
# @return [MessageDeleteEventHandler] the event handler that was registered.
|
|
87
|
+
def message_delete(attributes = {}, &block)
|
|
88
|
+
register_event(MessageDeleteEvent, attributes, block)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# This **event** is raised whenever a message is updated. Message updates can be triggered from
|
|
92
|
+
# a user editing their own message, or from Discord automatically attaching embeds to the
|
|
93
|
+
# user's message for URLs contained in the message's content. If you only want to listen
|
|
94
|
+
# for users editing their own messages, use the {message_edit} handler instead.
|
|
95
|
+
# @param attributes [Hash] The event's attributes.
|
|
96
|
+
# @option attributes [String, Integer] :id Matches the ID of the message that was updated.
|
|
97
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was updated in.
|
|
98
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was updated.
|
|
99
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was updated in.
|
|
100
|
+
# @yield The block is executed when the event is raised.
|
|
101
|
+
# @yieldparam event [MessageUpdateEvent] The event that was raised.
|
|
102
|
+
# @return [MessageUpdateEventHandler] the event handler that was registered.
|
|
103
|
+
|
|
104
|
+
# This **event** is raised whenever a message is updated. Message updates can be triggered from
|
|
105
|
+
# a user editing their own message, or from Discord automatically attaching embeds to the
|
|
106
|
+
# user's message for URLs contained in the message's content. If you only want to listen
|
|
107
|
+
# for users editing their own messages, use the {message_edit} handler instead.
|
|
108
|
+
# @param attributes [Hash] The event's attributes.
|
|
109
|
+
# @option attributes [String, Integer] :id Matches the ID of the message that was updated.
|
|
110
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was updated in.
|
|
111
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was updated.
|
|
112
|
+
# @option attributes [Server, Integer, String] :server Matches the server the message was updated in.
|
|
113
|
+
# @yield The block is executed when the event is raised.
|
|
114
|
+
# @yieldparam event [MessageUpdateEvent] The event that was raised.
|
|
115
|
+
# @return [MessageUpdateEventHandler] the event handler that was registered.
|
|
116
|
+
def message_update(attributes = {}, &block)
|
|
117
|
+
register_event(MessageUpdateEvent, attributes, block)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# This **event** is raised when somebody reacts to a message.
|
|
121
|
+
# @param attributes [Hash] The event's attributes.
|
|
122
|
+
# @option attributes [String, Integer] :emoji Matches the ID of the emoji that was reacted with, or its name.
|
|
123
|
+
# @option attributes [String, Integer, User] :from Matches the user who added the reaction.
|
|
124
|
+
# @option attributes [String, Integer, Message] :message Matches the message to which the reaction was added.
|
|
125
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the reaction was added in.
|
|
126
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of reaction (`:normal` or `:burst`) that was added.
|
|
127
|
+
# @yield The block is executed when the event is raised.
|
|
128
|
+
# @yieldparam event [ReactionAddEvent] The event that was raised.
|
|
129
|
+
# @return [ReactionAddEventHandler] The event handler that was registered.
|
|
130
|
+
|
|
131
|
+
# This **event** is raised when the bot is mentioned in a message.
|
|
132
|
+
# @param attributes [Hash] The event's attributes.
|
|
133
|
+
# @option attributes [String, Regexp] :start_with Matches the string the message starts with.
|
|
134
|
+
# @option attributes [String, Regexp] :end_with Matches the string the message ends with.
|
|
135
|
+
# @option attributes [String, Regexp] :contains Matches a string the message contains.
|
|
136
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was sent in.
|
|
137
|
+
# @option attributes [String, Integer, User] :from Matches the user that sent the message.
|
|
138
|
+
# @option attributes [String] :content Exactly matches the entire content of the message.
|
|
139
|
+
# @option attributes [Time] :after Matches a time after the time the message was sent at.
|
|
140
|
+
# @option attributes [Time] :before Matches a time before the time the message was sent at.
|
|
141
|
+
# @option attributes [Boolean] :private Matches whether or not the channel is private.
|
|
142
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was sent.
|
|
143
|
+
# @option attributes [true, false] :role_mention If the event should trigger when the bot's managed role is mentioned.
|
|
144
|
+
# @yield The block is executed when the event is raised.
|
|
145
|
+
# @yieldparam event [MentionEvent] The event that was raised.
|
|
146
|
+
# @return [MentionEventHandler] the event handler that was registered.
|
|
147
|
+
def mention(attributes = {}, &block)
|
|
148
|
+
register_event(MentionEvent, attributes, block)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# This **event** is raised when a channel is created.
|
|
152
|
+
# @param attributes [Hash] The event's attributes.
|
|
153
|
+
# @option attributes [Integer] :type Matches the type of channel that is being created (0: text, 1: private, 2: voice, 3: group)
|
|
154
|
+
# @option attributes [String] :name Matches the name of the created channel.
|
|
155
|
+
# @yield The block is executed when the event is raised.
|
|
156
|
+
# @yieldparam event [ChannelCreateEvent] The event that was raised.
|
|
157
|
+
# @return [ChannelCreateEventHandler] the event handler that was registered.
|
|
158
|
+
|
|
159
|
+
# This **event** is raised when a private message is sent to the bot.
|
|
160
|
+
# @param attributes [Hash] The event's attributes.
|
|
161
|
+
# @option attributes [String, Regexp] :start_with Matches the string the message starts with.
|
|
162
|
+
# @option attributes [String, Regexp] :end_with Matches the string the message ends with.
|
|
163
|
+
# @option attributes [String, Regexp] :contains Matches a string the message contains.
|
|
164
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was sent in.
|
|
165
|
+
# @option attributes [String, Integer, User] :from Matches the user that sent the message.
|
|
166
|
+
# @option attributes [String] :content Exactly matches the entire content of the message.
|
|
167
|
+
# @option attributes [Time] :after Matches a time after the time the message was sent at.
|
|
168
|
+
# @option attributes [Time] :before Matches a time before the time the message was sent at.
|
|
169
|
+
# @option attributes [Boolean] :private Matches whether or not the channel is private.
|
|
170
|
+
# @yield The block is executed when the event is raised.
|
|
171
|
+
# @yieldparam event [PrivateMessageEvent] The event that was raised.
|
|
172
|
+
# @return [PrivateMessageEventHandler] the event handler that was registered.
|
|
173
|
+
def pm(attributes = {}, &block)
|
|
174
|
+
register_event(PrivateMessageEvent, attributes, block)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
alias_method :private_message, :pm
|
|
178
|
+
alias_method :direct_message, :pm
|
|
179
|
+
alias_method :dm, :pm
|
|
180
|
+
|
|
181
|
+
# This **event** is raised when an invite is created.
|
|
182
|
+
# @param attributes [Hash] The event's attributes.
|
|
183
|
+
# @option attributes [String, Integer, User] :inviter Matches the user that created the invite.
|
|
184
|
+
# @option attributes [String, Integer, Channel] :channel Matches the channel the invite was created for.
|
|
185
|
+
# @option attributes [String, Integer, Server] :server Matches the server the invite was created for.
|
|
186
|
+
# @option attributes [true, false] :temporary Matches whether the invite is temporary or not.
|
|
187
|
+
# @yield The block is executed when the event is raised.
|
|
188
|
+
# @yieldparam event [InviteCreateEvent] The event that was raised.
|
|
189
|
+
# @return [InviteCreateEventHandler] The event handler that was registered.
|
|
190
|
+
|
|
191
|
+
# This **event** is raised when an {Await} is triggered. It provides an easy way to execute code
|
|
192
|
+
# on an await without having to rely on the await's block.
|
|
193
|
+
# @param attributes [Hash] The event's attributes.
|
|
194
|
+
# @option attributes [Symbol] :key Exactly matches the await's key.
|
|
195
|
+
# @option attributes [Class] :type Exactly matches the event's type.
|
|
196
|
+
# @yield The block is executed when the event is raised.
|
|
197
|
+
# @yieldparam event [AwaitEvent] The event that was raised.
|
|
198
|
+
# @return [AwaitEventHandler] the event handler that was registered.
|
|
199
|
+
def await(attributes = {}, &block)
|
|
200
|
+
register_event(AwaitEvent, attributes, block)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# This **event** is raised when a private message is sent to the bot.
|
|
204
|
+
# @param attributes [Hash] The event's attributes.
|
|
205
|
+
# @option attributes [String, Regexp] :start_with Matches the string the message starts with.
|
|
206
|
+
# @option attributes [String, Regexp] :end_with Matches the string the message ends with.
|
|
207
|
+
# @option attributes [String, Regexp] :contains Matches a string the message contains.
|
|
208
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was sent in.
|
|
209
|
+
# @option attributes [String, Integer, User] :from Matches the user that sent the message.
|
|
210
|
+
# @option attributes [String] :content Exactly matches the entire content of the message.
|
|
211
|
+
# @option attributes [Time] :after Matches a time after the time the message was sent at.
|
|
212
|
+
# @option attributes [Time] :before Matches a time before the time the message was sent at.
|
|
213
|
+
# @option attributes [Boolean] :private Matches whether or not the channel is private.
|
|
214
|
+
# @yield The block is executed when the event is raised.
|
|
215
|
+
# @yieldparam event [PrivateMessageEvent] The event that was raised.
|
|
216
|
+
# @return [PrivateMessageEventHandler] the event handler that was registered.
|
|
217
|
+
end
|
|
218
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnyxCord
|
|
4
|
+
module EventContainer
|
|
5
|
+
# This **event** is raised when a user's status (online/offline/idle) changes.
|
|
6
|
+
# @param attributes [Hash] The event's attributes.
|
|
7
|
+
# @option attributes [String, Integer, User] :from Matches the user whose status changed.
|
|
8
|
+
# @option attributes [:offline, :idle, :online] :status Matches the status the user has now.
|
|
9
|
+
# @option attributes [Hash<Symbol, Symbol>] :client_status Matches the current online status (`:online`, `:idle` or `:dnd`) of the user
|
|
10
|
+
# on various device types (`:desktop`, `:mobile`, or `:web`). The value will be `nil` when the user is offline or invisible
|
|
11
|
+
# @yield The block is executed when the event is raised.
|
|
12
|
+
# @yieldparam event [PresenceEvent] The event that was raised.
|
|
13
|
+
# @return [PresenceEventHandler] the event handler that was registered.
|
|
14
|
+
def presence(attributes = {}, &block)
|
|
15
|
+
register_event(PresenceEvent, attributes, block)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# This **event** is raised when the game a user is playing changes.
|
|
19
|
+
# @param attributes [Hash] The event's attributes.
|
|
20
|
+
# @option attributes [String, Integer, User] :from Matches the user whose playing game changes.
|
|
21
|
+
# @option attributes [String] :game Matches the game the user is now playing.
|
|
22
|
+
# @option attributes [Integer] :type Matches the type of game object (0 game, 1 Twitch stream)
|
|
23
|
+
# @yield The block is executed when the event is raised.
|
|
24
|
+
# @yieldparam event [PlayingEvent] The event that was raised.
|
|
25
|
+
# @return [PlayingEventHandler] the event handler that was registered.
|
|
26
|
+
|
|
27
|
+
# This **event** is raised when the game a user is playing changes.
|
|
28
|
+
# @param attributes [Hash] The event's attributes.
|
|
29
|
+
# @option attributes [String, Integer, User] :from Matches the user whose playing game changes.
|
|
30
|
+
# @option attributes [String] :game Matches the game the user is now playing.
|
|
31
|
+
# @option attributes [Integer] :type Matches the type of game object (0 game, 1 Twitch stream)
|
|
32
|
+
# @yield The block is executed when the event is raised.
|
|
33
|
+
# @yieldparam event [PlayingEvent] The event that was raised.
|
|
34
|
+
# @return [PlayingEventHandler] the event handler that was registered.
|
|
35
|
+
def playing(attributes = {}, &block)
|
|
36
|
+
register_event(PlayingEvent, attributes, block)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# This **event** is raised when the bot is mentioned in a message.
|
|
40
|
+
# @param attributes [Hash] The event's attributes.
|
|
41
|
+
# @option attributes [String, Regexp] :start_with Matches the string the message starts with.
|
|
42
|
+
# @option attributes [String, Regexp] :end_with Matches the string the message ends with.
|
|
43
|
+
# @option attributes [String, Regexp] :contains Matches a string the message contains.
|
|
44
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the message was sent in.
|
|
45
|
+
# @option attributes [String, Integer, User] :from Matches the user that sent the message.
|
|
46
|
+
# @option attributes [String] :content Exactly matches the entire content of the message.
|
|
47
|
+
# @option attributes [Time] :after Matches a time after the time the message was sent at.
|
|
48
|
+
# @option attributes [Time] :before Matches a time before the time the message was sent at.
|
|
49
|
+
# @option attributes [Boolean] :private Matches whether or not the channel is private.
|
|
50
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of the message that was sent.
|
|
51
|
+
# @option attributes [true, false] :role_mention If the event should trigger when the bot's managed role is mentioned.
|
|
52
|
+
# @yield The block is executed when the event is raised.
|
|
53
|
+
# @yieldparam event [MentionEvent] The event that was raised.
|
|
54
|
+
# @return [MentionEventHandler] the event handler that was registered.
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnyxCord
|
|
4
|
+
module EventContainer
|
|
5
|
+
# This **event** is raised for every dispatch received over the gateway, whether supported by onyxcord or not.
|
|
6
|
+
# @param attributes [Hash] The event's attributes.
|
|
7
|
+
# @option attributes [String, Symbol, Regexp] :type Matches the event type of the dispatch.
|
|
8
|
+
# @yield The block is executed when the event is raised.
|
|
9
|
+
# @yieldparam event [RawEvent] The event that was raised.
|
|
10
|
+
# @return [RawEventHandler] The event handler that was registered.
|
|
11
|
+
def raw(filter = nil, &block)
|
|
12
|
+
filter = filter[:type] || filter[:t] if filter.is_a?(Hash)
|
|
13
|
+
register_raw_handler(filter, block)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# This **event** is raised for a dispatch received over the gateway that is not currently handled otherwise by
|
|
17
|
+
# onyxcord.
|
|
18
|
+
# @param attributes [Hash] The event's attributes.
|
|
19
|
+
# @option attributes [String, Symbol, Regexp] :type Matches the event type of the dispatch.
|
|
20
|
+
# @yield The block is executed when the event is raised.
|
|
21
|
+
# @yieldparam event [UnknownEvent] The event that was raised.
|
|
22
|
+
# @return [UnknownEventHandler] The event handler that was registered.
|
|
23
|
+
|
|
24
|
+
# This **event** is raised for a dispatch received over the gateway that is not currently handled otherwise by
|
|
25
|
+
# onyxcord.
|
|
26
|
+
# @param attributes [Hash] The event's attributes.
|
|
27
|
+
# @option attributes [String, Symbol, Regexp] :type Matches the event type of the dispatch.
|
|
28
|
+
# @yield The block is executed when the event is raised.
|
|
29
|
+
# @yieldparam event [UnknownEvent] The event that was raised.
|
|
30
|
+
# @return [UnknownEventHandler] The event handler that was registered.
|
|
31
|
+
def unknown(attributes = {}, &block)
|
|
32
|
+
register_event(UnknownEvent, attributes, block)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Removes an event handler from this container. If you're looking for a way to do temporary events, I recommend
|
|
36
|
+
# {Await}s instead of this.
|
|
37
|
+
# @param handler [OnyxCord::Events::EventHandler] The handler to remove.
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OnyxCord
|
|
4
|
+
module EventContainer
|
|
5
|
+
# This **event** is raised when somebody reacts to a message.
|
|
6
|
+
# @param attributes [Hash] The event's attributes.
|
|
7
|
+
# @option attributes [String, Integer] :emoji Matches the ID of the emoji that was reacted with, or its name.
|
|
8
|
+
# @option attributes [String, Integer, User] :from Matches the user who added the reaction.
|
|
9
|
+
# @option attributes [String, Integer, Message] :message Matches the message to which the reaction was added.
|
|
10
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the reaction was added in.
|
|
11
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of reaction (`:normal` or `:burst`) that was added.
|
|
12
|
+
# @yield The block is executed when the event is raised.
|
|
13
|
+
# @yieldparam event [ReactionAddEvent] The event that was raised.
|
|
14
|
+
# @return [ReactionAddEventHandler] The event handler that was registered.
|
|
15
|
+
def reaction_add(attributes = {}, &block)
|
|
16
|
+
register_event(ReactionAddEvent, attributes, block)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# This **event** is raised when somebody removes a reaction from a message.
|
|
20
|
+
# @param attributes [Hash] The event's attributes.
|
|
21
|
+
# @option attributes [String, Integer] :emoji Matches the ID of the emoji that was removed from the reactions, or
|
|
22
|
+
# its name.
|
|
23
|
+
# @option attributes [String, Integer, User] :from Matches the user who removed the reaction.
|
|
24
|
+
# @option attributes [String, Integer, Message] :message Matches the message to which the reaction was removed.
|
|
25
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the reaction was removed in.
|
|
26
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of reaction (`:normal` or `:burst`) that was added.
|
|
27
|
+
# @yield The block is executed when the event is raised.
|
|
28
|
+
# @yieldparam event [ReactionRemoveEvent] The event that was raised.
|
|
29
|
+
# @return [ReactionRemoveEventHandler] The event handler that was registered.
|
|
30
|
+
|
|
31
|
+
# This **event** is raised when somebody removes a reaction from a message.
|
|
32
|
+
# @param attributes [Hash] The event's attributes.
|
|
33
|
+
# @option attributes [String, Integer] :emoji Matches the ID of the emoji that was removed from the reactions, or
|
|
34
|
+
# its name.
|
|
35
|
+
# @option attributes [String, Integer, User] :from Matches the user who removed the reaction.
|
|
36
|
+
# @option attributes [String, Integer, Message] :message Matches the message to which the reaction was removed.
|
|
37
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the reaction was removed in.
|
|
38
|
+
# @option attributes [Integer, String, Symbol] :type Matches the type of reaction (`:normal` or `:burst`) that was added.
|
|
39
|
+
# @yield The block is executed when the event is raised.
|
|
40
|
+
# @yieldparam event [ReactionRemoveEvent] The event that was raised.
|
|
41
|
+
# @return [ReactionRemoveEventHandler] The event handler that was registered.
|
|
42
|
+
def reaction_remove(attributes = {}, &block)
|
|
43
|
+
register_event(ReactionRemoveEvent, attributes, block)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# This **event** is raised when somebody removes all reactions from a message.
|
|
47
|
+
# @param attributes [Hash] The event's attributes.
|
|
48
|
+
# @option attributes [Hash] The event's attributes.
|
|
49
|
+
# @option attributes [String, Integer, Message] :message Matches the message to which the reactions were removed.
|
|
50
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the reactions were removed in.
|
|
51
|
+
# @yield The block is executed when the event is raised.
|
|
52
|
+
# @yieldparam event [ReactionRemoveAllEvent] The event that was raised.
|
|
53
|
+
# @return [ReactionRemoveAllEventHandler] The event handler that was registered.
|
|
54
|
+
|
|
55
|
+
# This **event** is raised when somebody removes all reactions from a message.
|
|
56
|
+
# @param attributes [Hash] The event's attributes.
|
|
57
|
+
# @option attributes [Hash] The event's attributes.
|
|
58
|
+
# @option attributes [String, Integer, Message] :message Matches the message to which the reactions were removed.
|
|
59
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel the reactions were removed in.
|
|
60
|
+
# @yield The block is executed when the event is raised.
|
|
61
|
+
# @yieldparam event [ReactionRemoveAllEvent] The event that was raised.
|
|
62
|
+
# @return [ReactionRemoveAllEventHandler] The event handler that was registered.
|
|
63
|
+
def reaction_remove_all(attributes = {}, &block)
|
|
64
|
+
register_event(ReactionRemoveAllEvent, attributes, block)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# This **event** is raised when somebody removes all instances of a single reaction from a message.
|
|
68
|
+
# @param attributes [Hash] The event's attributes.
|
|
69
|
+
# @option attributes [String, Integer, Message] :message Matches the message where the reaction was removed.
|
|
70
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel where the reaction was removed.
|
|
71
|
+
# @option attributes [String, Integer] :emoji Matches the ID of the emoji that was removed, or its name.
|
|
72
|
+
# @yield The block is executed when the event is raised.
|
|
73
|
+
# @yieldparam event [ReactionRemoveEmojiEvent] The event that was raised.
|
|
74
|
+
# @return [ReactionRemoveEmojiEventHandler] The event handler that was registered.
|
|
75
|
+
|
|
76
|
+
# This **event** is raised when somebody removes all instances of a single reaction from a message.
|
|
77
|
+
# @param attributes [Hash] The event's attributes.
|
|
78
|
+
# @option attributes [String, Integer, Message] :message Matches the message where the reaction was removed.
|
|
79
|
+
# @option attributes [String, Integer, Channel] :in Matches the channel where the reaction was removed.
|
|
80
|
+
# @option attributes [String, Integer] :emoji Matches the ID of the emoji that was removed, or its name.
|
|
81
|
+
# @yield The block is executed when the event is raised.
|
|
82
|
+
# @yieldparam event [ReactionRemoveEmojiEvent] The event that was raised.
|
|
83
|
+
# @return [ReactionRemoveEmojiEventHandler] The event handler that was registered.
|
|
84
|
+
def reaction_remove_emoji(attributes = {}, &block)
|
|
85
|
+
register_event(ReactionRemoveEmojiEvent, attributes, block)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# This **event** is raised when a user's status (online/offline/idle) changes.
|
|
89
|
+
# @param attributes [Hash] The event's attributes.
|
|
90
|
+
# @option attributes [String, Integer, User] :from Matches the user whose status changed.
|
|
91
|
+
# @option attributes [:offline, :idle, :online] :status Matches the status the user has now.
|
|
92
|
+
# @option attributes [Hash<Symbol, Symbol>] :client_status Matches the current online status (`:online`, `:idle` or `:dnd`) of the user
|
|
93
|
+
# on various device types (`:desktop`, `:mobile`, or `:web`). The value will be `nil` when the user is offline or invisible
|
|
94
|
+
# @yield The block is executed when the event is raised.
|
|
95
|
+
# @yieldparam event [PresenceEvent] The event that was raised.
|
|
96
|
+
# @return [PresenceEventHandler] the event handler that was registered.
|
|
97
|
+
end
|
|
98
|
+
end
|