onyxcord 2.0.13 → 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/{errors.rb → core/errors.rb} +18 -3
- 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/internal/message_payload.rb +78 -0
- 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/upload.rb +39 -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 +22 -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 +13 -11
- data/lib/onyxcord/models.rb +57 -0
- data/lib/onyxcord/{api.rb → rest/client.rb} +83 -27
- 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} +10 -33
- 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 +30 -32
- data/lib/onyxcord/{allowed_mentions.rb → utils/allowed_mentions.rb} +9 -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 -40
- metadata +208 -91
- 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 -202
- 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 -705
- 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 -1143
- data/lib/onyxcord/data.rb +0 -57
- data/lib/onyxcord/event_executor.rb +0 -153
- data/lib/onyxcord/gateway.rb +0 -500
- data/lib/onyxcord/http.rb +0 -115
- data/lib/onyxcord/json.rb +0 -49
- data/lib/onyxcord/rate_limiter/async_rest.rb +0 -149
- 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/{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,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'onyxcord/events/generic'
|
|
4
|
+
require 'onyxcord/models'
|
|
5
|
+
|
|
6
|
+
module OnyxCord::Events
|
|
7
|
+
# Raised when a channel is deleted
|
|
8
|
+
class ChannelDeleteEvent < Event
|
|
9
|
+
# @return [Integer] the channel's type (0: text, 1: private, 2: voice, 3: group).
|
|
10
|
+
attr_reader :type
|
|
11
|
+
|
|
12
|
+
# @return [String] the channel's topic
|
|
13
|
+
attr_reader :topic
|
|
14
|
+
|
|
15
|
+
# @return [Integer] the position of the channel on the list
|
|
16
|
+
attr_reader :position
|
|
17
|
+
|
|
18
|
+
# @return [String] the channel's name
|
|
19
|
+
attr_reader :name
|
|
20
|
+
|
|
21
|
+
# @return [Integer] the channel's ID
|
|
22
|
+
attr_reader :id
|
|
23
|
+
|
|
24
|
+
# @return [Server] the channel's server
|
|
25
|
+
attr_reader :server
|
|
26
|
+
|
|
27
|
+
# @return [Integer, nil] the channel's owner ID if this is a group channel
|
|
28
|
+
attr_reader :owner_id
|
|
29
|
+
|
|
30
|
+
# @!visibility private
|
|
31
|
+
def initialize(data, bot)
|
|
32
|
+
@bot = bot
|
|
33
|
+
|
|
34
|
+
@type = data['type']
|
|
35
|
+
@topic = data['topic']
|
|
36
|
+
@position = data['position']
|
|
37
|
+
@name = data['name']
|
|
38
|
+
@is_private = data['is_private']
|
|
39
|
+
@id = data['id'].to_i
|
|
40
|
+
@server = bot.server(data['guild_id'].to_i) if data['guild_id']
|
|
41
|
+
@owner_id = bot.user(data['owner_id']) if @type == 3
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Event handler for ChannelDeleteEvent
|
|
46
|
+
|
|
47
|
+
# Event handler for ChannelDeleteEvent
|
|
48
|
+
class ChannelDeleteEventHandler < EventHandler
|
|
49
|
+
def matches?(event)
|
|
50
|
+
# Check for the proper event type
|
|
51
|
+
return false unless event.is_a? ChannelDeleteEvent
|
|
52
|
+
|
|
53
|
+
[
|
|
54
|
+
matches_all(@attributes[:type], event.type) do |a, e|
|
|
55
|
+
a == if a.is_a? String
|
|
56
|
+
e.name
|
|
57
|
+
else
|
|
58
|
+
e
|
|
59
|
+
end
|
|
60
|
+
end,
|
|
61
|
+
matches_all(@attributes[:name], event.name) do |a, e|
|
|
62
|
+
a == if a.is_a? String
|
|
63
|
+
e.to_s
|
|
64
|
+
else
|
|
65
|
+
e
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
].reduce(true, &:&)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Generic subclass for recipient events (add/remove)
|
|
73
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'onyxcord/events/generic'
|
|
4
|
+
require 'onyxcord/models'
|
|
5
|
+
|
|
6
|
+
module OnyxCord::Events
|
|
7
|
+
# Raised when a message is pinned or unpinned.
|
|
8
|
+
class ChannelPinsUpdateEvent < Event
|
|
9
|
+
# @return [Time, nil] Time at which the most recent pinned message was pinned.
|
|
10
|
+
attr_reader :last_pin_timestamp
|
|
11
|
+
|
|
12
|
+
# @return [Channel] The channel this event originates from.
|
|
13
|
+
attr_reader :channel
|
|
14
|
+
|
|
15
|
+
# @return [Server, nil] The server this event originates from.
|
|
16
|
+
attr_reader :server
|
|
17
|
+
|
|
18
|
+
# @!visibility private
|
|
19
|
+
def initialize(data, bot)
|
|
20
|
+
@bot = bot
|
|
21
|
+
|
|
22
|
+
@server = bot.server(data['guild_id']) if data['guild_id']
|
|
23
|
+
@channel = bot.channel(data['channel_id'])
|
|
24
|
+
@last_pin_timestamp = Time.iso8601(data['last_pin_timestamp']) if data['last_pin_timestamp']
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Event handler for ChannelPinsUpdateEvent.
|
|
29
|
+
|
|
30
|
+
# Event handler for ChannelPinsUpdateEvent.
|
|
31
|
+
class ChannelPinsUpdateEventHandler < EventHandler
|
|
32
|
+
def matches?(event)
|
|
33
|
+
# Check for the proper event type.
|
|
34
|
+
return false unless event.is_a? ChannelPinsUpdateEvent
|
|
35
|
+
|
|
36
|
+
[
|
|
37
|
+
matches_all(@attributes[:server], event.server) { |a, e| a.resolve_id == e&.id },
|
|
38
|
+
matches_all(@attributes[:channel], event.channel) { |a, e| a.resolve_id == e.id }
|
|
39
|
+
].reduce(true, &:&)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Raised when a user is added to a private channel
|
|
44
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'onyxcord/events/generic'
|
|
4
|
+
require 'onyxcord/models'
|
|
5
|
+
|
|
6
|
+
module OnyxCord::Events
|
|
7
|
+
# Generic subclass for recipient events (add/remove)
|
|
8
|
+
class ChannelRecipientEvent < Event
|
|
9
|
+
# @return [Channel] the channel in question.
|
|
10
|
+
attr_reader :channel
|
|
11
|
+
|
|
12
|
+
delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel
|
|
13
|
+
|
|
14
|
+
# @return [Recipient] the recipient that was added/removed from the group
|
|
15
|
+
attr_reader :recipient
|
|
16
|
+
|
|
17
|
+
delegate :id, to: :recipient
|
|
18
|
+
|
|
19
|
+
# @!visibility private
|
|
20
|
+
def initialize(data, bot)
|
|
21
|
+
@bot = bot
|
|
22
|
+
|
|
23
|
+
@channel = bot.channel(data['channel_id'].to_i)
|
|
24
|
+
recipient = data['user']
|
|
25
|
+
recipient_user = bot.ensure_user(recipient)
|
|
26
|
+
@recipient = OnyxCord::Recipient.new(recipient_user, @channel, bot)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Generic event handler for channel recipient events
|
|
31
|
+
|
|
32
|
+
# Generic event handler for channel recipient events
|
|
33
|
+
class ChannelRecipientEventHandler < EventHandler
|
|
34
|
+
def matches?(event)
|
|
35
|
+
# Check for the proper event type
|
|
36
|
+
return false unless event.is_a? ChannelRecipientEvent
|
|
37
|
+
|
|
38
|
+
[
|
|
39
|
+
matches_all(@attributes[:owner_id], event.owner_id) do |a, e|
|
|
40
|
+
a.resolve_id == e.resolve_id
|
|
41
|
+
end,
|
|
42
|
+
matches_all(@attributes[:id], event.id) do |a, e|
|
|
43
|
+
a.resolve_id == e.resolve_id
|
|
44
|
+
end,
|
|
45
|
+
matches_all(@attributes[:name], event.name) do |a, e|
|
|
46
|
+
a == if a.is_a? String
|
|
47
|
+
e.to_s
|
|
48
|
+
else
|
|
49
|
+
e
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
]
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Raised when a message is pinned or unpinned.
|
|
57
|
+
|
|
58
|
+
# Raised when a user is added to a private channel
|
|
59
|
+
class ChannelRecipientAddEvent < ChannelRecipientEvent; end
|
|
60
|
+
|
|
61
|
+
# Event handler for ChannelRecipientAddEvent
|
|
62
|
+
|
|
63
|
+
# Event handler for ChannelRecipientAddEvent
|
|
64
|
+
class ChannelRecipientAddEventHandler < ChannelRecipientEventHandler; end
|
|
65
|
+
|
|
66
|
+
# Raised when a recipient that isn't the bot leaves or is kicked from a group channel
|
|
67
|
+
|
|
68
|
+
# Raised when a recipient that isn't the bot leaves or is kicked from a group channel
|
|
69
|
+
class ChannelRecipientRemoveEvent < ChannelRecipientEvent; end
|
|
70
|
+
|
|
71
|
+
# Event handler for ChannelRecipientRemoveEvent
|
|
72
|
+
|
|
73
|
+
# Event handler for ChannelRecipientRemoveEvent
|
|
74
|
+
class ChannelRecipientRemoveEventHandler < ChannelRecipientEventHandler; end
|
|
75
|
+
|
|
76
|
+
# Raised when a channel is updated (e.g. topic changes)
|
|
77
|
+
end
|
|
@@ -1,241 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'onyxcord/events/
|
|
4
|
-
require 'onyxcord/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# Raised when a channel is created
|
|
8
|
-
class ChannelCreateEvent < Event
|
|
9
|
-
# @return [Channel] the channel in question.
|
|
10
|
-
attr_reader :channel
|
|
11
|
-
|
|
12
|
-
# @!attribute [r] type
|
|
13
|
-
# @return [Integer] the channel's type (0: text, 1: private, 2: voice, 3: group).
|
|
14
|
-
# @see Channel#type
|
|
15
|
-
# @!attribute [r] topic
|
|
16
|
-
# @return [String] the channel's topic.
|
|
17
|
-
# @see Channel#topic
|
|
18
|
-
# @!attribute [r] position
|
|
19
|
-
# @return [Integer] the position of the channel in the channels list.
|
|
20
|
-
# @see Channel#position
|
|
21
|
-
# @!attribute [r] name
|
|
22
|
-
# @return [String] the channel's name
|
|
23
|
-
# @see Channel#name
|
|
24
|
-
# @!attribute [r] id
|
|
25
|
-
# @return [Integer] the channel's unique ID.
|
|
26
|
-
# @see Channel#id
|
|
27
|
-
# @!attribute [r] server
|
|
28
|
-
# @return [Server] the server the channel belongs to.
|
|
29
|
-
# @see Channel#server
|
|
30
|
-
delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel
|
|
31
|
-
|
|
32
|
-
# @!visibility private
|
|
33
|
-
def initialize(data, bot)
|
|
34
|
-
@bot = bot
|
|
35
|
-
@channel = if data.is_a?(OnyxCord::Channel)
|
|
36
|
-
data
|
|
37
|
-
else
|
|
38
|
-
cached_channel(bot, data['id']) || OnyxCord::Channel.new(data, bot, cached_server(bot, data['guild_id']))
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def cached_channel(bot, channel_id)
|
|
43
|
-
channels = bot.instance_variable_get(:@channels)
|
|
44
|
-
channels&.[](channel_id.to_i)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def cached_server(bot, server_id)
|
|
48
|
-
return nil unless server_id
|
|
49
|
-
|
|
50
|
-
servers = bot.instance_variable_get(:@servers)
|
|
51
|
-
servers&.[](server_id.to_i)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Event handler for ChannelCreateEvent
|
|
56
|
-
class ChannelCreateEventHandler < EventHandler
|
|
57
|
-
def matches?(event)
|
|
58
|
-
# Check for the proper event type
|
|
59
|
-
return false unless event.is_a? ChannelCreateEvent
|
|
60
|
-
|
|
61
|
-
[
|
|
62
|
-
matches_all(@attributes[:type], event.type) do |a, e|
|
|
63
|
-
a == if a.is_a? String
|
|
64
|
-
e.name
|
|
65
|
-
else
|
|
66
|
-
e
|
|
67
|
-
end
|
|
68
|
-
end,
|
|
69
|
-
matches_all(@attributes[:name], event.name) do |a, e|
|
|
70
|
-
a == if a.is_a? String
|
|
71
|
-
e.to_s
|
|
72
|
-
else
|
|
73
|
-
e
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
].reduce(true, &:&)
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Raised when a channel is deleted
|
|
81
|
-
class ChannelDeleteEvent < Event
|
|
82
|
-
# @return [Integer] the channel's type (0: text, 1: private, 2: voice, 3: group).
|
|
83
|
-
attr_reader :type
|
|
84
|
-
|
|
85
|
-
# @return [String] the channel's topic
|
|
86
|
-
attr_reader :topic
|
|
87
|
-
|
|
88
|
-
# @return [Integer] the position of the channel on the list
|
|
89
|
-
attr_reader :position
|
|
90
|
-
|
|
91
|
-
# @return [String] the channel's name
|
|
92
|
-
attr_reader :name
|
|
93
|
-
|
|
94
|
-
# @return [Integer] the channel's ID
|
|
95
|
-
attr_reader :id
|
|
96
|
-
|
|
97
|
-
# @return [Server] the channel's server
|
|
98
|
-
attr_reader :server
|
|
99
|
-
|
|
100
|
-
# @return [Integer, nil] the channel's owner ID if this is a group channel
|
|
101
|
-
attr_reader :owner_id
|
|
102
|
-
|
|
103
|
-
# @!visibility private
|
|
104
|
-
def initialize(data, bot)
|
|
105
|
-
@bot = bot
|
|
106
|
-
|
|
107
|
-
@type = data['type']
|
|
108
|
-
@topic = data['topic']
|
|
109
|
-
@position = data['position']
|
|
110
|
-
@name = data['name']
|
|
111
|
-
@is_private = data['is_private']
|
|
112
|
-
@id = data['id'].to_i
|
|
113
|
-
@server = bot.server(data['guild_id'].to_i) if data['guild_id']
|
|
114
|
-
@owner_id = bot.user(data['owner_id']) if @type == 3
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
# Event handler for ChannelDeleteEvent
|
|
119
|
-
class ChannelDeleteEventHandler < EventHandler
|
|
120
|
-
def matches?(event)
|
|
121
|
-
# Check for the proper event type
|
|
122
|
-
return false unless event.is_a? ChannelDeleteEvent
|
|
123
|
-
|
|
124
|
-
[
|
|
125
|
-
matches_all(@attributes[:type], event.type) do |a, e|
|
|
126
|
-
a == if a.is_a? String
|
|
127
|
-
e.name
|
|
128
|
-
else
|
|
129
|
-
e
|
|
130
|
-
end
|
|
131
|
-
end,
|
|
132
|
-
matches_all(@attributes[:name], event.name) do |a, e|
|
|
133
|
-
a == if a.is_a? String
|
|
134
|
-
e.to_s
|
|
135
|
-
else
|
|
136
|
-
e
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
].reduce(true, &:&)
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
# Generic subclass for recipient events (add/remove)
|
|
144
|
-
class ChannelRecipientEvent < Event
|
|
145
|
-
# @return [Channel] the channel in question.
|
|
146
|
-
attr_reader :channel
|
|
147
|
-
|
|
148
|
-
delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel
|
|
149
|
-
|
|
150
|
-
# @return [Recipient] the recipient that was added/removed from the group
|
|
151
|
-
attr_reader :recipient
|
|
152
|
-
|
|
153
|
-
delegate :id, to: :recipient
|
|
154
|
-
|
|
155
|
-
# @!visibility private
|
|
156
|
-
def initialize(data, bot)
|
|
157
|
-
@bot = bot
|
|
158
|
-
|
|
159
|
-
@channel = bot.channel(data['channel_id'].to_i)
|
|
160
|
-
recipient = data['user']
|
|
161
|
-
recipient_user = bot.ensure_user(recipient)
|
|
162
|
-
@recipient = OnyxCord::Recipient.new(recipient_user, @channel, bot)
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
# Generic event handler for channel recipient events
|
|
167
|
-
class ChannelRecipientEventHandler < EventHandler
|
|
168
|
-
def matches?(event)
|
|
169
|
-
# Check for the proper event type
|
|
170
|
-
return false unless event.is_a? ChannelRecipientEvent
|
|
171
|
-
|
|
172
|
-
[
|
|
173
|
-
matches_all(@attributes[:owner_id], event.owner_id) do |a, e|
|
|
174
|
-
a.resolve_id == e.resolve_id
|
|
175
|
-
end,
|
|
176
|
-
matches_all(@attributes[:id], event.id) do |a, e|
|
|
177
|
-
a.resolve_id == e.resolve_id
|
|
178
|
-
end,
|
|
179
|
-
matches_all(@attributes[:name], event.name) do |a, e|
|
|
180
|
-
a == if a.is_a? String
|
|
181
|
-
e.to_s
|
|
182
|
-
else
|
|
183
|
-
e
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
]
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
# Raised when a message is pinned or unpinned.
|
|
191
|
-
class ChannelPinsUpdateEvent < Event
|
|
192
|
-
# @return [Time, nil] Time at which the most recent pinned message was pinned.
|
|
193
|
-
attr_reader :last_pin_timestamp
|
|
194
|
-
|
|
195
|
-
# @return [Channel] The channel this event originates from.
|
|
196
|
-
attr_reader :channel
|
|
197
|
-
|
|
198
|
-
# @return [Server, nil] The server this event originates from.
|
|
199
|
-
attr_reader :server
|
|
200
|
-
|
|
201
|
-
# @!visibility private
|
|
202
|
-
def initialize(data, bot)
|
|
203
|
-
@bot = bot
|
|
204
|
-
|
|
205
|
-
@server = bot.server(data['guild_id']) if data['guild_id']
|
|
206
|
-
@channel = bot.channel(data['channel_id'])
|
|
207
|
-
@last_pin_timestamp = Time.iso8601(data['last_pin_timestamp']) if data['last_pin_timestamp']
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
# Event handler for ChannelPinsUpdateEvent.
|
|
212
|
-
class ChannelPinsUpdateEventHandler < EventHandler
|
|
213
|
-
def matches?(event)
|
|
214
|
-
# Check for the proper event type.
|
|
215
|
-
return false unless event.is_a? ChannelPinsUpdateEvent
|
|
216
|
-
|
|
217
|
-
[
|
|
218
|
-
matches_all(@attributes[:server], event.server) { |a, e| a.resolve_id == e&.id },
|
|
219
|
-
matches_all(@attributes[:channel], event.channel) { |a, e| a.resolve_id == e.id }
|
|
220
|
-
].reduce(true, &:&)
|
|
221
|
-
end
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
# Raised when a user is added to a private channel
|
|
225
|
-
class ChannelRecipientAddEvent < ChannelRecipientEvent; end
|
|
226
|
-
|
|
227
|
-
# Event handler for ChannelRecipientAddEvent
|
|
228
|
-
class ChannelRecipientAddEventHandler < ChannelRecipientEventHandler; end
|
|
229
|
-
|
|
230
|
-
# Raised when a recipient that isn't the bot leaves or is kicked from a group channel
|
|
231
|
-
class ChannelRecipientRemoveEvent < ChannelRecipientEvent; end
|
|
232
|
-
|
|
233
|
-
# Event handler for ChannelRecipientRemoveEvent
|
|
234
|
-
class ChannelRecipientRemoveEventHandler < ChannelRecipientEventHandler; end
|
|
235
|
-
|
|
236
|
-
# Raised when a channel is updated (e.g. topic changes)
|
|
237
|
-
class ChannelUpdateEvent < ChannelCreateEvent; end
|
|
238
|
-
|
|
239
|
-
# Event handler for ChannelUpdateEvent
|
|
240
|
-
class ChannelUpdateEventHandler < ChannelCreateEventHandler; end
|
|
241
|
-
end
|
|
3
|
+
require 'onyxcord/events/channels/base'
|
|
4
|
+
require 'onyxcord/events/channels/delete'
|
|
5
|
+
require 'onyxcord/events/channels/recipients'
|
|
6
|
+
require 'onyxcord/events/channels/pins'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'onyxcord/events/generic'
|
|
4
|
+
require 'onyxcord/models'
|
|
5
|
+
|
|
6
|
+
module OnyxCord::Events
|
|
7
|
+
# Raised whenever an audit log entry is created.
|
|
8
|
+
class AuditLogEntryCreateEvent < Event
|
|
9
|
+
# @return [Server] the server of the audit log event.
|
|
10
|
+
attr_reader :server
|
|
11
|
+
|
|
12
|
+
# @return [AuditLogs::Entry] the entry of the audit log event.
|
|
13
|
+
attr_reader :entry
|
|
14
|
+
|
|
15
|
+
# @return [Integer] the raw action type of the audit log entry.
|
|
16
|
+
attr_reader :action
|
|
17
|
+
|
|
18
|
+
# @return [Integer] the ID of the user or bot that made the entry.
|
|
19
|
+
attr_reader :user_id
|
|
20
|
+
|
|
21
|
+
# @return [Integer, nil] the ID of the affected webhook, user, etc.
|
|
22
|
+
attr_reader :target_id
|
|
23
|
+
|
|
24
|
+
# @!visibility private
|
|
25
|
+
def initialize(data, bot)
|
|
26
|
+
@bot = bot
|
|
27
|
+
@action = data['action_type']
|
|
28
|
+
@user_id = data['user_id']&.to_i
|
|
29
|
+
@target_id = data['target_id']&.to_i
|
|
30
|
+
@server = bot.server(data['guild_id'].to_i)
|
|
31
|
+
@entry = OnyxCord::AuditLogs::Entry.new(nil, @server, @bot, data)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Event handler for GUILD_AUDIT_LOG_ENTRY_CREATE events.
|
|
36
|
+
|
|
37
|
+
# Event handler for GUILD_AUDIT_LOG_ENTRY_CREATE events.
|
|
38
|
+
class AuditLogEntryCreateEventHandler < EventHandler
|
|
39
|
+
# @!visibility private
|
|
40
|
+
def matches?(event)
|
|
41
|
+
# Check for the proper event type.
|
|
42
|
+
return false unless event.is_a?(AuditLogEntryCreateEvent)
|
|
43
|
+
|
|
44
|
+
[
|
|
45
|
+
matches_all(@attributes[:action], event) do |a, e|
|
|
46
|
+
case a
|
|
47
|
+
when Numeric
|
|
48
|
+
a == e.action
|
|
49
|
+
when String, Symbol
|
|
50
|
+
a.to_sym == e.entry.action
|
|
51
|
+
end
|
|
52
|
+
end,
|
|
53
|
+
|
|
54
|
+
matches_all(@attributes[:reason], event.entry) do |a, e|
|
|
55
|
+
if e.reason
|
|
56
|
+
case a
|
|
57
|
+
when String
|
|
58
|
+
a == e.reason
|
|
59
|
+
when Regexp
|
|
60
|
+
a.match?(e.reason)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end,
|
|
64
|
+
|
|
65
|
+
matches_all(@attributes[:user], event.user_id) do |a, e|
|
|
66
|
+
a&.resolve_id == e&.resolve_id
|
|
67
|
+
end,
|
|
68
|
+
|
|
69
|
+
matches_all(@attributes[:server], event.server) do |a, e|
|
|
70
|
+
a&.resolve_id == e&.resolve_id
|
|
71
|
+
end,
|
|
72
|
+
|
|
73
|
+
matches_all(@attributes[:target], event.target_id) do |a, e|
|
|
74
|
+
a&.resolve_id == e&.resolve_id
|
|
75
|
+
end
|
|
76
|
+
].reduce(true, &:&)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'onyxcord/events/generic'
|
|
4
|
+
require 'onyxcord/models'
|
|
5
|
+
|
|
6
|
+
module OnyxCord::Events
|
|
7
|
+
# Generic subclass for server events (create/update/delete)
|
|
8
|
+
class ServerEvent < Event
|
|
9
|
+
# @return [Server] the server in question.
|
|
10
|
+
attr_reader :server
|
|
11
|
+
|
|
12
|
+
# @!visibility private
|
|
13
|
+
def initialize(data, bot)
|
|
14
|
+
@bot = bot
|
|
15
|
+
|
|
16
|
+
init_server(data, bot)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Initializes this event with server data. Should be overwritten in case the server doesn't exist at the time
|
|
20
|
+
# of event creation (e. g. {ServerDeleteEvent})
|
|
21
|
+
def init_server(data, bot)
|
|
22
|
+
@server = bot.server(data['id'].to_i)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Generic event handler for member events
|
|
27
|
+
|
|
28
|
+
# Generic event handler for member events
|
|
29
|
+
class ServerEventHandler < EventHandler
|
|
30
|
+
def matches?(event)
|
|
31
|
+
# Check for the proper event type
|
|
32
|
+
return false unless event.is_a? ServerEvent
|
|
33
|
+
|
|
34
|
+
[
|
|
35
|
+
matches_all(@attributes[:server], event.server) do |a, e|
|
|
36
|
+
a == case a
|
|
37
|
+
when String
|
|
38
|
+
e.name
|
|
39
|
+
when Integer
|
|
40
|
+
e.id
|
|
41
|
+
else
|
|
42
|
+
e
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
].reduce(true, &:&)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Server is created
|
|
50
|
+
# @see OnyxCord::EventContainer#server_create
|
|
51
|
+
|
|
52
|
+
# Server is created
|
|
53
|
+
# @see OnyxCord::EventContainer#server_create
|
|
54
|
+
class ServerCreateEvent < ServerEvent; end
|
|
55
|
+
|
|
56
|
+
# Event handler for {ServerCreateEvent}
|
|
57
|
+
|
|
58
|
+
# Event handler for {ServerCreateEvent}
|
|
59
|
+
class ServerCreateEventHandler < ServerEventHandler; end
|
|
60
|
+
|
|
61
|
+
# Server is updated (e.g. name changed)
|
|
62
|
+
# @see OnyxCord::EventContainer#server_update
|
|
63
|
+
|
|
64
|
+
# Server is updated (e.g. name changed)
|
|
65
|
+
# @see OnyxCord::EventContainer#server_update
|
|
66
|
+
class ServerUpdateEvent < ServerEvent; end
|
|
67
|
+
|
|
68
|
+
# Event handler for {ServerUpdateEvent}
|
|
69
|
+
|
|
70
|
+
# Event handler for {ServerUpdateEvent}
|
|
71
|
+
class ServerUpdateEventHandler < ServerEventHandler; end
|
|
72
|
+
|
|
73
|
+
# Server is deleted, the server was left because the bot was kicked, or the
|
|
74
|
+
# bot made itself leave the server.
|
|
75
|
+
# @see OnyxCord::EventContainer#server_delete
|
|
76
|
+
|
|
77
|
+
# Server is deleted, the server was left because the bot was kicked, or the
|
|
78
|
+
# bot made itself leave the server.
|
|
79
|
+
# @see OnyxCord::EventContainer#server_delete
|
|
80
|
+
class ServerDeleteEvent < ServerEvent
|
|
81
|
+
# @return [Integer] The ID of the server that was left.
|
|
82
|
+
attr_reader :server
|
|
83
|
+
|
|
84
|
+
# @!visibility private
|
|
85
|
+
# @note Override init_server to account for the deleted server
|
|
86
|
+
def init_server(data, _bot)
|
|
87
|
+
@server = data['id'].to_i
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Event handler for {ServerDeleteEvent}
|
|
92
|
+
|
|
93
|
+
# Event handler for {ServerDeleteEvent}
|
|
94
|
+
class ServerDeleteEventHandler < ServerEventHandler; end
|
|
95
|
+
|
|
96
|
+
# Emoji is created/deleted/updated
|
|
97
|
+
end
|