Search in sources :

Example 1 with EmojiObject

use of sx.blah.discord.api.internal.json.objects.EmojiObject in project Discord4J by Discord4J.

the class EmojiImpl method changeName.

@Override
public void changeName(String name) {
    PermissionUtils.requirePermissions(getGuild(), getClient().getOurUser(), Permissions.MANAGE_EMOJIS);
    EmojiObject response = ((DiscordClientImpl) getClient()).REQUESTS.PATCH.makeRequest(DiscordEndpoints.GUILDS + getGuild().getStringID() + "/emojis/" + getStringID(), new EmojiEditRequest(name, getRoles().toArray(new IRole[getRoles().size()])), EmojiObject.class);
    IEmoji emoji = DiscordUtils.getEmojiFromJSON(getGuild(), response);
}
Also used : EmojiObject(sx.blah.discord.api.internal.json.objects.EmojiObject) EmojiEditRequest(sx.blah.discord.api.internal.json.requests.EmojiEditRequest) DiscordClientImpl(sx.blah.discord.api.internal.DiscordClientImpl) IEmoji(sx.blah.discord.handle.obj.IEmoji)

Example 2 with EmojiObject

use of sx.blah.discord.api.internal.json.objects.EmojiObject in project Discord4J by Discord4J.

the class EmojiImpl method changeRoles.

@Override
public void changeRoles(IRole[] roles) {
    PermissionUtils.requirePermissions(getGuild(), getClient().getOurUser(), Permissions.MANAGE_EMOJIS);
    EmojiObject response = ((DiscordClientImpl) getClient()).REQUESTS.PATCH.makeRequest(DiscordEndpoints.GUILDS + getGuild().getStringID() + "/emojis/" + getStringID(), new EmojiEditRequest(getName(), roles), EmojiObject.class);
    IEmoji emoji = DiscordUtils.getEmojiFromJSON(getGuild(), response);
}
Also used : EmojiObject(sx.blah.discord.api.internal.json.objects.EmojiObject) EmojiEditRequest(sx.blah.discord.api.internal.json.requests.EmojiEditRequest) DiscordClientImpl(sx.blah.discord.api.internal.DiscordClientImpl) IEmoji(sx.blah.discord.handle.obj.IEmoji)

Aggregations

DiscordClientImpl (sx.blah.discord.api.internal.DiscordClientImpl)2 EmojiObject (sx.blah.discord.api.internal.json.objects.EmojiObject)2 EmojiEditRequest (sx.blah.discord.api.internal.json.requests.EmojiEditRequest)2 IEmoji (sx.blah.discord.handle.obj.IEmoji)2