discord_api 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -1
- data/lib/discord/client.rb +4 -0
- data/lib/discord/resources/guilds.rb +24 -0
- data/lib/discord/version.rb +1 -1
- data/lib/discord.rb +1 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5b44836b278c5d28cd0a2c6fe4009eae2957b0c6bc803fa9cfcc277b7eb794b
|
4
|
+
data.tar.gz: 6b7b1de20d49ba721cdd56409e06ce854973951d0dec7a1e38ca44046dd52da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f32b3a7c6103ceedf3455e10ee7ec02d89522b34031c5d8fe546bf31d02103e3afdbf422f9c5876a0d9735f5ae005876015b033e24e448826caa1e004950cb5
|
7
|
+
data.tar.gz: 3f14957f832318e5a7c590830fbc0e7ac7f45a32c1299db78d70d8f98a9e764f614410896f41bb5eaa5de6fac8ee2fc5891300b8efda6f8b6386bb8a3bf80f5f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Discord API
|
2
2
|
|
3
|
-
This is a Ruby
|
3
|
+
This is a Ruby library for the Discord HTTP API. **Currently in development**
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -75,3 +75,32 @@ These endpoints are only accessible using a bot token.
|
|
75
75
|
# Bulk delete messages
|
76
76
|
@client.messages.bulk_delete(channel_id: 123123, ids: [123123, 321321])
|
77
77
|
```
|
78
|
+
|
79
|
+
### Guilds/Servers
|
80
|
+
|
81
|
+
These endpoints are only accessible using a bot token.
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
# Retrieve a Guild's details
|
85
|
+
@client.guilds.retrieve(id: 123123)
|
86
|
+
|
87
|
+
# Update a Guild's details
|
88
|
+
# https://discord.com/developers/docs/resources/guild#modify-guild
|
89
|
+
@client.guilds.update(id: 123123, name: "new-guild-name")
|
90
|
+
|
91
|
+
# Retrieve a list of a Guild's channels
|
92
|
+
@client.guilds.channels(guild: 123123)
|
93
|
+
|
94
|
+
# Create a Guild channel
|
95
|
+
# https://discord.com/developers/docs/resources/guild#create-guild-channel
|
96
|
+
@client.guilds.create_channel(guild: 123123, name: "new-channel-name")
|
97
|
+
```
|
98
|
+
|
99
|
+
## Contributing
|
100
|
+
|
101
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/discord_api.
|
102
|
+
|
103
|
+
## License
|
104
|
+
|
105
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
106
|
+
|
data/lib/discord/client.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Discord
|
2
|
+
class GuildsResource < Resource
|
3
|
+
|
4
|
+
def retrieve(id:)
|
5
|
+
Guild.new get_request("guilds/#{id}").body
|
6
|
+
end
|
7
|
+
|
8
|
+
def update(id:, **params)
|
9
|
+
response = patch_request("guilds/#{id}", body: params)
|
10
|
+
Guild.new response.body
|
11
|
+
end
|
12
|
+
|
13
|
+
def channels(guild:)
|
14
|
+
response = get_request("guilds/#{guild}/channels")
|
15
|
+
Collection.from_response(response, type: Channel)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_channel(guild:, **params)
|
19
|
+
response = post_request("guilds/#{guild}/channels", body: params)
|
20
|
+
Channel.new response.body
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/discord/version.rb
CHANGED
data/lib/discord.rb
CHANGED
@@ -13,6 +13,7 @@ module Discord
|
|
13
13
|
autoload :UsersResource, "discord/resources/users"
|
14
14
|
autoload :ChannelsResource, "discord/resources/channels"
|
15
15
|
autoload :MessagesResource, "discord/resources/messages"
|
16
|
+
autoload :GuildsResource, "discord/resources/guilds"
|
16
17
|
|
17
18
|
autoload :User, "discord/objects/user"
|
18
19
|
autoload :Guild, "discord/objects/guild"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discord_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- lib/discord/objects/user.rb
|
48
48
|
- lib/discord/resource.rb
|
49
49
|
- lib/discord/resources/channels.rb
|
50
|
+
- lib/discord/resources/guilds.rb
|
50
51
|
- lib/discord/resources/messages.rb
|
51
52
|
- lib/discord/resources/users.rb
|
52
53
|
- lib/discord/version.rb
|
@@ -73,8 +74,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: '0'
|
75
76
|
requirements: []
|
76
|
-
rubygems_version: 3.4.
|
77
|
+
rubygems_version: 3.4.20
|
77
78
|
signing_key:
|
78
79
|
specification_version: 4
|
79
|
-
summary: Ruby
|
80
|
+
summary: Ruby library for the Discord HTTP API
|
80
81
|
test_files: []
|