-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added political compass meme command
- Loading branch information
1 parent
fd3fadc
commit ba0770e
Showing
6 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...ain/java/me/trackrunny/jdalearning/command/commands/meme/PoliticalCompassMemeCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
* JDALearningBot - Discord bot to learn JDA 4 library * | ||
* Copyright (C) 2019-2020 TrackRunny * | ||
* * | ||
* This program is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. * | ||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
|
||
package me.trackrunny.jdalearning.command.commands.meme; | ||
|
||
import me.trackrunny.jdalearning.Bot; | ||
import me.trackrunny.jdalearning.command.CommandContext; | ||
import me.trackrunny.jdalearning.command.ICommand; | ||
import me.trackrunny.jdalearning.variables.Variables; | ||
import net.dv8tion.jda.api.EmbedBuilder; | ||
import net.dv8tion.jda.api.entities.MessageEmbed; | ||
import net.dv8tion.jda.api.entities.TextChannel; | ||
import net.explodingbush.ksoftapi.entities.Reddit; | ||
import net.explodingbush.ksoftapi.enums.ImageType; | ||
|
||
import java.awt.*; | ||
|
||
public class PoliticalCompassMemeCommand implements ICommand { | ||
@Override | ||
public void handle(CommandContext ctx) { | ||
final TextChannel channel = ctx.getChannel(); | ||
|
||
final EmbedBuilder embedBuilder = new EmbedBuilder(); | ||
|
||
final Reddit reddit = Bot.kSoftAPI.getRedditImage(ImageType.RANDOM_REDDIT).setSubreddit("PoliticalCompassMemes").execute(); | ||
|
||
embedBuilder.setTitle("→ " + reddit.getTitle()); | ||
embedBuilder.setImage(reddit.getImageUrl()); | ||
embedBuilder.setFooter(Variables.embedFooter); | ||
embedBuilder.setColor(new Color(Variables.embedColor)); | ||
|
||
channel.sendMessage(embedBuilder.build()).queue(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "compassmeme"; | ||
} | ||
|
||
@Override | ||
public MessageEmbed getHelp() { | ||
final EmbedBuilder embedBuilder = new EmbedBuilder(); | ||
embedBuilder.setTitle("→ Command Usage"); | ||
embedBuilder.setDescription("• Sends out a political compass meme!"); | ||
embedBuilder.setFooter(Variables.embedFooter); | ||
embedBuilder.setColor(new Color(Variables.embedColor)); | ||
|
||
return embedBuilder.build(); | ||
} | ||
} |