discorb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +56 -0
  3. data/.yardopts +6 -0
  4. data/Changelog.md +5 -0
  5. data/Gemfile +23 -0
  6. data/Gemfile.lock +70 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +53 -0
  9. data/Rakefile +46 -0
  10. data/bin/console +15 -0
  11. data/bin/setup +8 -0
  12. data/discorb.gemspec +37 -0
  13. data/docs/Examples.md +26 -0
  14. data/docs/events.md +480 -0
  15. data/docs/voice_events.md +283 -0
  16. data/examples/components/authorization_button.rb +43 -0
  17. data/examples/components/select_menu.rb +61 -0
  18. data/examples/extension/main.rb +12 -0
  19. data/examples/extension/message_expander.rb +41 -0
  20. data/examples/simple/eval.rb +32 -0
  21. data/examples/simple/ping_pong.rb +16 -0
  22. data/examples/simple/rolepanel.rb +65 -0
  23. data/examples/simple/wait_for_message.rb +30 -0
  24. data/lib/discorb/application.rb +157 -0
  25. data/lib/discorb/asset.rb +57 -0
  26. data/lib/discorb/audit_logs.rb +323 -0
  27. data/lib/discorb/channel.rb +1101 -0
  28. data/lib/discorb/client.rb +363 -0
  29. data/lib/discorb/color.rb +173 -0
  30. data/lib/discorb/common.rb +123 -0
  31. data/lib/discorb/components.rb +290 -0
  32. data/lib/discorb/dictionary.rb +119 -0
  33. data/lib/discorb/embed.rb +345 -0
  34. data/lib/discorb/emoji.rb +218 -0
  35. data/lib/discorb/emoji_table.rb +3799 -0
  36. data/lib/discorb/error.rb +98 -0
  37. data/lib/discorb/event.rb +35 -0
  38. data/lib/discorb/extend.rb +18 -0
  39. data/lib/discorb/extension.rb +54 -0
  40. data/lib/discorb/file.rb +69 -0
  41. data/lib/discorb/flag.rb +109 -0
  42. data/lib/discorb/gateway.rb +967 -0
  43. data/lib/discorb/gateway_requests.rb +47 -0
  44. data/lib/discorb/guild.rb +1244 -0
  45. data/lib/discorb/guild_template.rb +211 -0
  46. data/lib/discorb/image.rb +43 -0
  47. data/lib/discorb/integration.rb +111 -0
  48. data/lib/discorb/intents.rb +137 -0
  49. data/lib/discorb/interaction.rb +333 -0
  50. data/lib/discorb/internet.rb +285 -0
  51. data/lib/discorb/invite.rb +145 -0
  52. data/lib/discorb/log.rb +70 -0
  53. data/lib/discorb/member.rb +232 -0
  54. data/lib/discorb/message.rb +583 -0
  55. data/lib/discorb/modules.rb +138 -0
  56. data/lib/discorb/permission.rb +270 -0
  57. data/lib/discorb/presence.rb +308 -0
  58. data/lib/discorb/reaction.rb +48 -0
  59. data/lib/discorb/role.rb +189 -0
  60. data/lib/discorb/sticker.rb +157 -0
  61. data/lib/discorb/user.rb +163 -0
  62. data/lib/discorb/utils.rb +16 -0
  63. data/lib/discorb/voice_state.rb +251 -0
  64. data/lib/discorb/webhook.rb +420 -0
  65. data/lib/discorb.rb +51 -0
  66. metadata +120 -0
data/lib/discorb.rb ADDED
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A new wrapper for the Discorb API.
4
+ #
5
+ # @author sevenc-nanashi
6
+ module Discorb
7
+ # @!visibility private
8
+ # @!macro [new] async
9
+ # @note This is an asynchronous method, it will return a `Async::Task` object. Use `Async::Task#wait` to get the result.
10
+ #
11
+ # @!macro [new] client_cache
12
+ # @note This method returns an object from client cache. it will return `nil` if the object is not in cache.
13
+ # @return [nil] The object wasn't cached.
14
+ #
15
+ # @!macro members_intent
16
+ # @note You must enable `GUILD_MEMBERS` intent to use this method.
17
+ #
18
+ # @!macro edit
19
+ # @note The arguments of this method are defaultly set to `:unset`. Specify value to set the value, if not don't specify or specify `:unset`.
20
+ #
21
+ # @!macro http
22
+ # @note This method calls HTTP request.
23
+ # @raise [Discorb::HTTPError] HTTP request failed.
24
+ #
25
+ def macro
26
+ # NOTE: this method is only for YARD.
27
+ puts 'Wow, You found the easter egg!\n\n'
28
+ red = "\e[31m"
29
+ reset = "\e[m"
30
+ puts <<~"EASTEREGG"
31
+ | . #{red} | #{reset}
32
+ __| #{red} |__ #{reset}
33
+ / | | __ __ _ #{red} _ | \\ #{reset}
34
+ ( | | (__ / / \\ #{red}|/ | ) #{reset}
35
+ \\__| | __) \\__ \\_/ #{red}| |__/ #{reset}
36
+
37
+ https://github.com/discorb-lib/discorb
38
+ EASTEREGG
39
+ end
40
+ end
41
+
42
+ require_order = %w[common flag dictionary error internet intents emoji_table modules] +
43
+ %w[user member guild emoji channel embed message] +
44
+ %w[application audit_logs color components event extension] +
45
+ %w[file guild_template image integration interaction invite log permission] +
46
+ %w[presence reaction role sticker utils voice_state webhook] +
47
+ %w[gateway_requests gateway] +
48
+ %w[asset client extend]
49
+ require_order.each do |name|
50
+ require_relative "discorb/#{name}.rb"
51
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: discorb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - sevenc-nanashi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-08-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: "# discorb\n[![rubydoc](https://img.shields.io/badge/Document-rubydoc.info-blue.svg)](https://rubydoc.info/gems/discorb)\n[![Gem](https://img.shields.io/gem/dt/discorb?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/discorb)\n[![Gem](https://img.shields.io/gem/v/discorb?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/discorb)
14
+ \ \n\ndiscorb is a Discord API wrapper for Ruby.\n\n## Installation\n\nAdd this
15
+ line to your application's Gemfile:\n\n```ruby\ngem 'discorb'\n```\n\nAnd then execute:\n\n
16
+ \ $ bundle install\n\nOr install it yourself as:\n\n $ gem install discorb\n\n##
17
+ Usage\n\n### Simple ping-pong\n\n```ruby\nrequire \"discorb\"\n\nclient = Discorb::Client.new\n\nclient.once
18
+ :ready do\n puts \"Logged in as #{client.user}\"\nend\n\nclient.on :message do
19
+ |_task, message|\n next if message.author.bot?\n next unless message.content ==
20
+ \"ping\"\n\n message.channel.post(\"Pong!\")\nend\n\nclient.run(ENV[\"DISCORD_BOT_TOKEN\"])\n```\n\n##
21
+ Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/sevenc-nanashi/discorb.\n\n##
22
+ License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n"
23
+ email:
24
+ - sevenc-nanashi@sevenbot.jp
25
+ executables: []
26
+ extensions: []
27
+ extra_rdoc_files: []
28
+ files:
29
+ - ".gitignore"
30
+ - ".yardopts"
31
+ - Changelog.md
32
+ - Gemfile
33
+ - Gemfile.lock
34
+ - LICENSE.txt
35
+ - README.md
36
+ - Rakefile
37
+ - bin/console
38
+ - bin/setup
39
+ - discorb.gemspec
40
+ - docs/Examples.md
41
+ - docs/events.md
42
+ - docs/voice_events.md
43
+ - examples/components/authorization_button.rb
44
+ - examples/components/select_menu.rb
45
+ - examples/extension/main.rb
46
+ - examples/extension/message_expander.rb
47
+ - examples/simple/eval.rb
48
+ - examples/simple/ping_pong.rb
49
+ - examples/simple/rolepanel.rb
50
+ - examples/simple/wait_for_message.rb
51
+ - lib/discorb.rb
52
+ - lib/discorb/application.rb
53
+ - lib/discorb/asset.rb
54
+ - lib/discorb/audit_logs.rb
55
+ - lib/discorb/channel.rb
56
+ - lib/discorb/client.rb
57
+ - lib/discorb/color.rb
58
+ - lib/discorb/common.rb
59
+ - lib/discorb/components.rb
60
+ - lib/discorb/dictionary.rb
61
+ - lib/discorb/embed.rb
62
+ - lib/discorb/emoji.rb
63
+ - lib/discorb/emoji_table.rb
64
+ - lib/discorb/error.rb
65
+ - lib/discorb/event.rb
66
+ - lib/discorb/extend.rb
67
+ - lib/discorb/extension.rb
68
+ - lib/discorb/file.rb
69
+ - lib/discorb/flag.rb
70
+ - lib/discorb/gateway.rb
71
+ - lib/discorb/gateway_requests.rb
72
+ - lib/discorb/guild.rb
73
+ - lib/discorb/guild_template.rb
74
+ - lib/discorb/image.rb
75
+ - lib/discorb/integration.rb
76
+ - lib/discorb/intents.rb
77
+ - lib/discorb/interaction.rb
78
+ - lib/discorb/internet.rb
79
+ - lib/discorb/invite.rb
80
+ - lib/discorb/log.rb
81
+ - lib/discorb/member.rb
82
+ - lib/discorb/message.rb
83
+ - lib/discorb/modules.rb
84
+ - lib/discorb/permission.rb
85
+ - lib/discorb/presence.rb
86
+ - lib/discorb/reaction.rb
87
+ - lib/discorb/role.rb
88
+ - lib/discorb/sticker.rb
89
+ - lib/discorb/user.rb
90
+ - lib/discorb/utils.rb
91
+ - lib/discorb/voice_state.rb
92
+ - lib/discorb/webhook.rb
93
+ homepage: https://github.com/sevenc-nanashi/discorb
94
+ licenses:
95
+ - MIT
96
+ metadata:
97
+ allowed_push_host: https://rubygems.org
98
+ homepage_uri: https://github.com/sevenc-nanashi/discorb
99
+ source_code_uri: https://github.com/sevenc-nanashi/discorb
100
+ changelog_uri: https://github.com/sevenc-nanashi/discorb/blob/main/Changelog.md
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 3.0.0
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubygems_version: 3.2.22
117
+ signing_key:
118
+ specification_version: 4
119
+ summary: discorb is a Discord API wrapper for Ruby.
120
+ test_files: []