use of com.sx4.bot.core.Sx4CommandEvent in project Sx4 by sx4-discord-bot.
the class CatCommand method onCommand.
public void onCommand(Sx4CommandEvent event) {
Request request = new Request.Builder().url("http://aws.random.cat/meow").build();
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> {
Document data = Document.parse(response.body().string());
EmbedBuilder embed = new EmbedBuilder().setDescription(":cat:").setImage(data.getString("file"));
event.reply(embed.build()).queue();
});
}
use of com.sx4.bot.core.Sx4CommandEvent in project Sx4 by sx4-discord-bot.
the class DuckCommand method onCommand.
public void onCommand(Sx4CommandEvent event) {
Request request = new Request.Builder().url("https://random-d.uk/api/v1/random").build();
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> {
Document data = Document.parse(response.body().string());
EmbedBuilder embed = new EmbedBuilder().setDescription(":duck:").setImage(data.getString("url"));
event.reply(embed.build()).queue();
});
}
use of com.sx4.bot.core.Sx4CommandEvent in project Sx4 by sx4-discord-bot.
the class EmbossCommand 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("emboss")).addQuery("image", imageUrl).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
}
use of com.sx4.bot.core.Sx4CommandEvent in project Sx4 by sx4-discord-bot.
the class FlagCommand method onCommand.
public void onCommand(Sx4CommandEvent event, @Argument(value = "flag code") String flagCode, @Argument(value = "image url", endless = true, acceptEmpty = true) @ImageUrl String imageUrl) {
Request request = new ImageRequest(event.getConfig().getImageWebserverUrl("flag")).addQuery("image", imageUrl).addQuery("flag", flagCode).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> {
ImageUtility.getImageMessage(event, response, (body, error) -> {
if (error == ImageError.INVALID_QUERY_VALUE) {
return event.replyFailure(body.getString("message"));
}
return null;
}).queue();
});
}
use of com.sx4.bot.core.Sx4CommandEvent in project Sx4 by sx4-discord-bot.
the class GayCommand 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("gay")).addQuery("image", imageUrl).build(event.getConfig().getImageWebserver());
event.getHttpClient().newCall(request).enqueue((HttpCallback) response -> ImageUtility.getImageMessage(event, response).queue());
}
Aggregations