use of com.sx4.bot.http.HttpCallback in project Sx4 by sx4-discord-bot.
the class ChangeColourCommand method onCommand.
public void onCommand(Sx4CommandEvent event, @Argument(value = "image", acceptEmpty = true) @ImageUrl String imageUrl, @Argument(value = "colour", endless = true) @Colour int colour) {
Request request = new ImageRequest(event.getConfig().getImageWebserverUrl("manipulate-colour")).addQuery("image", imageUrl).addQuery("colour", colour).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
}
use of com.sx4.bot.http.HttpCallback in project Sx4 by sx4-discord-bot.
the class DiscordCommand method onCommand.
public void onCommand(Sx4CommandEvent event, @Argument(value = "user", nullDefault = true) Member member, @Argument(value = "text | message id", endless = true) @Limit(max = 250) Or<MessageArgument, String> option, @Option(value = "light", description = "Sets the discord theme to light") boolean light) {
if (member == null && option.hasSecond()) {
event.replyFailure("You need to provide a user when not giving a message").queue();
return;
}
this.getContext(option, member).thenAccept(pair -> {
Member effectiveMember = pair.getLeft();
User user = effectiveMember.getUser();
String text = pair.getRight();
Request request = new ImageRequest(event.getConfig().getImageWebserverUrl("discord")).addField("name", effectiveMember.getEffectiveName()).addField("avatar", user.getEffectiveAvatarUrl()).addField("bot", user.isBot()).addField("dark_theme", !light).addField("colour", effectiveMember.getColorRaw()).addField("text", text).addAllFields(this.getMentions(event.getShardManager(), event.getGuild(), text)).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
});
}
use of com.sx4.bot.http.HttpCallback in project Sx4 by sx4-discord-bot.
the class DriftCommand method onCommand.
public void onCommand(Sx4CommandEvent event, @Argument(value = "user", nullDefault = true) Member member, @Argument(value = "left text") @Limit(max = 30) String leftText, @Argument(value = "right text", endless = true, nullDefault = true) @Limit(max = 40) String rightText) {
ImageRequest request = new ImageRequest(event.getConfig().getImageWebserverUrl("drift")).addQuery("left_text", leftText).addQuery("image", (member == null ? event.getAuthor() : member.getUser()).getEffectiveAvatarUrl());
if (rightText != null) {
request.addQuery("right_text", rightText);
}
event.getHttpClient().newCall(request.build(event.getConfig().getImageWebserver())).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
}
use of com.sx4.bot.http.HttpCallback in project Sx4 by sx4-discord-bot.
the class FearCommand method onCommand.
public void onCommand(Sx4CommandEvent event, @Argument(value = "image url", endless = true, acceptEmpty = true) @ImageUrl String imageUrl) {
Request request = new ImageRequest(event.getConfig().getImageWebserverUrl("fear")).addQuery("image", imageUrl).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
}
use of com.sx4.bot.http.HttpCallback in project Sx4 by sx4-discord-bot.
the class HalloweenCommand method onCommand.
public void onCommand(Sx4CommandEvent event, @Argument(value = "image url", endless = true, acceptEmpty = true) @ImageUrl String imageUrl) {
Request request = new ImageRequest(event.getConfig().getImageWebserverUrl("halloween")).addQuery("image", imageUrl).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
}
Aggregations