Class: Discorb::ClientUser
- Inherits:
-
User
- Object
- DiscordModel
- User
- Discorb::ClientUser
- Defined in:
- lib/discorb/user.rb
Overview
Represents a client user.
Instance Attribute Summary
Attributes inherited from User
#avatar, #bot, #created_at, #discriminator, #flag, #id, #mention, #username, #verified
Instance Method Summary collapse
-
#edit(name: :unset, avatar: :unset) -> Object
Edit the client user.
Methods inherited from User
Methods included from Messageable
#delete_message!, #edit_message, #fetch_message, #fetch_messages, #fetch_pins, #pin_message, #post, #typing, #unpin_message
Methods inherited from DiscordModel
Instance Method Details
#edit(name: :unset, avatar: :unset) -> Object
Note:
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
Note:
This method calls HTTP request.
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
.
Edit the client user.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/discorb/user.rb', line 160 def edit(name: :unset, avatar: :unset) Async do payload = {} payload[:username] = name unless name == :unset if avatar == :unset # Nothing elsif avatar.nil? payload[:avatar] = nil else payload[:avatar] = avatar.to_s end @client.http.patch("/users/@me", payload).wait self end end |