Initial Commit

master
simpilldev 2 years ago
parent c5ace98962
commit e4c9474a78

Binary file not shown.

Binary file not shown.

@ -21,6 +21,8 @@ public class Commands extends ListenerAdapter {
private static final String HELP_COMMAND = "/help";
private static final String COMMANDS_COMMAND = "/commands";
private static final String MEMES_COMMAND = "/meme";
private static final String CHOOSE_WOWLET_COMMAND = "/choosewowlet";
private static final String CLI_WOWLET_COMMAND = "/cli";
private static final String GUI_WOWLET_COMMAND = "/desktop";
@ -56,6 +58,7 @@ public class Commands extends ListenerAdapter {
case GETTING_STARTED_COMMAND -> messageChannel.sendMessageEmbeds(responses.gettingStartedReply()).queue();
case ELI5_COMMAND -> messageChannel.sendMessageEmbeds(responses.eliFiveReply()).queue();
case COMMANDS_COMMAND, HELP_COMMAND -> messageChannel.sendMessageEmbeds(responses.commandsReply()).queue();
case MEMES_COMMAND -> messageChannel.sendMessageEmbeds(responses.memeReply()).queue();
case RICH_LIST_COMMAND -> messageChannel.sendMessageEmbeds(responses.richListReply()).queue();
case DONATE_COMMAND -> messageChannel.sendMessageEmbeds(responses.donateReply()).queue();
case WOW_PRICE_COMMAND -> messageChannel.sendMessageEmbeds(responses.getPriceReply()).queue();
@ -72,7 +75,6 @@ public class Commands extends ListenerAdapter {
case WOWNERUJO_COMMAND -> messageChannel.sendMessageEmbeds(responses.wownerujoReply()).queue();
case PAPER_WOWLET_COMMAND -> messageChannel.sendMessageEmbeds(responses.paperReply()).queue();
case ALL_WOWLETS_COMMAND -> messageChannel.sendMessageEmbeds(responses.allWowletsReply()).queue();
case "/img" -> messageChannel.sendMessageEmbeds(responses.memeReply()).queue();
}
} else {
boolean hi = (msgArray[0].equals("hi") && msgArray.length == 1)

@ -2,57 +2,64 @@ package WowneroChanBot;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.util.Random;
public class Memes {
public String getLatestMeme() {
return getImgUrlString("https://suchwow.xyz/");
}
public static int url = 0;
public static int authorName = 1;
public static int authorUrl = 2;
public static int authorAddress = 3;
public String getTopMeme() {
return getImgUrlString("https://suchwow.xyz/leaderboards/top_posts?days=9999");
}
private static final String suchWowWebsiteUrlString = "https://suchwow.xyz";
public String[] getRandomMemes() {
return null;
public String[] getRandomMeme() {
int randInt = new Random().nextInt(1, getAmountOfMemes());
String[] memeData = getMemeData(suchWowWebsiteUrlString + "/post/" + randInt);
System.out.println(suchWowWebsiteUrlString + "/post/" + randInt);
return memeData;
}
private static String getImgUrlString(String postUrl) {
private static String[] getMemeData(String postUrl) {
String[] memeData = new String[4];
Document doc = null;
try {
return Jsoup.connect(postUrl).userAgent("Mozilla/5.0").timeout(10000).get().select("img").get(1).absUrl("src");
doc = Jsoup.connect(postUrl).userAgent("Mozilla/5.0").timeout(10000).get();
memeData[url] = doc.select("img").get(1).absUrl("src");
memeData[authorAddress] = doc.select("i").get(2).text();
memeData[authorName] = doc.select("a").get(15).text();
memeData[authorUrl] = suchWowWebsiteUrlString + "/?submitter=" + doc.select("a").get(15).text();
System.out.println(memeData[url] + "\n" + memeData[authorName] + "\n" + memeData[authorUrl] + "\n" + memeData[authorAddress]);
return memeData;
}
catch (IOException | NullPointerException getRequestFailedException) {
getRequestFailedException.printStackTrace();
System.out.println("Could not retrieve image :(");
return "null";
}
return null;
}
public String getLatestMemeUrl() {
Document doc = null;
public int getAmountOfMemes() {
Document document = null;
try {
doc = Jsoup.connect("https://suchwow.xyz/").userAgent("Mozilla/5.0").timeout(10000).get();
document = Jsoup.connect(suchWowWebsiteUrlString).userAgent("Mozilla/5.0").timeout(10000).get();
} catch (IOException e) {
e.printStackTrace();
}
String str = document.select("img").attr("alt");
Element link = doc.select("p.title is-4 > a").first();
String url = link.attr("href");
return url;
}
int lastDigitIndex = 9;
// private static int getNumberOfMemes() {
//
// }
while (Character.isDigit(str.toCharArray()[lastDigitIndex])) {
lastDigitIndex++;
}
return Integer.parseInt(str.substring(9, lastDigitIndex));
}
// private String getRandomMemeUrl(int totalMemes) {
// Random random = new Random();
// random.nextInt(1, )
// }
}

@ -10,12 +10,13 @@ import javax.annotation.Nullable;
import java.util.List;
import static WowneroChanBot.Converter.*;
import static WowneroChanBot.Memes.*;
import static WowneroChanBot.WowneroChanBot.*;
public class Responses {
private static final String WOWNEROCHAN_IMG_URL = "https://i.redd.it/i2ovdj34ze481.png";
private static final String WOWNERO_IMG_URL = "https://external-preview.redd.it/HRaWRhx24ARVtIzMnzOK-1OmUU7AGlQKU-d4W0G4Ask.jpg?auto=webp&s=57a482fdb8191854e2c3efb54ddca969bb5ff16f";
private static final String WOWNERO_IMG_URL = "https://gitlab.com/simpilldev/discord-wownerochan-bot/-/blob/master/img/wownero-spin.gif";
private static final int WOWNERO_PINK = 0xEA12FF;
private static final String EMBED_FOOTER = BOT_NAME + " \uD83E\uDD0D";
private static final String COINGECKO_LINK = "https://www.coingecko.com/en/coins/wownero";
@ -91,23 +92,15 @@ public class Responses {
return createMessageEmbed(embedTitle, null, richList, null, WOWNERO_PINK);
}
public MessageEmbed memeReply() {
String embedTitle = "Wownero meemee";
String embedTitleUrl = "https://suchwow.xyz/post/1160";
String[] memeData = new Memes().getRandomMeme();
String memeUrl = new Memes().getLatestMeme();
String embedTitle = "Meme from " + memeData[authorName];
String embedTitleUrl = memeData[authorUrl];
String description = "Donate some WOW to [" + memeData[authorName] + "](" + memeData[authorUrl] + "):\n" + memeData[authorAddress];
if (memeUrl.equalsIgnoreCase("null")) {
return createMessageEmbed("Cannot retrieve image :(", null, null, null, WOWNERO_PINK);
} else {
return createMessageEmbed(embedTitle, embedTitleUrl, null, memeUrl, WOWNERO_PINK);
}
return createMessageEmbed(embedTitle, embedTitleUrl, description, memeData[url].equalsIgnoreCase("null") ? null : memeData[url], WOWNERO_PINK);
}
//Help
public Message helpReply(String user) {
final String helpResponse = "Hi " + user + " :) Try \"/commands\" for the full list of commands.";
return createMessage(helpResponse);
}
public MessageEmbed commandsReply() {
final String embedTitle = BOT_NAME + " Commands";
final String gettingStartedCommandsDescription = """
@ -208,11 +201,10 @@ public class Responses {
final String embedTitle = "CLI Wowlet";
final String embedTitleUrl = "https://git.wownero.com/wownero/wownero/releases";
final String description = "The CLI (command line interface) wowlet is a wowlet that allows you to send, receive and manage your WOW directly from the command line.";
final String imgUrl = "attachment://img/cli-wowlet.png";
final String imgUrl = "https://gitlab.com/simpilldev/discord-wownerochan-bot/-/blob/master/img/cli-wowlet.png";
return createMessageEmbed(embedTitle, embedTitleUrl, description, imgUrl, WOWNERO_PINK);
}
public MessageEmbed guiReply() {
final String embedTitle = "Desktop Wowlet";
final String embedTitleUrl = "https://git.wownero.com/wowlet/wowlet/releases";
@ -221,16 +213,14 @@ public class Responses {
return createMessageEmbed(embedTitle, embedTitleUrl, description, imgUrl, WOWNERO_PINK);
}
public MessageEmbed webReply() {
final String embedTitle = "Web Wowlet";
final String embedTitleUrl = "https://wowstash.app/";
final String description = "Wowstash is a web-based wowlet that allows you to use WOW regardless of what device you use.";
final String imgUrl = "https://wownero.org/img/Wownero_Le_Gem_Illustration_Asset.svg";
final String imgUrl = "https://gitlab.com/simpilldev/discord-wownerochan-bot/-/blob/master/img/wow-stash.png";
return createMessageEmbed(embedTitle, embedTitleUrl, description, imgUrl, WOWNERO_PINK);
}
public MessageEmbed wownerujoReply() {
final String embedTitle = "Wownerujo Wowlet";
final String embedTitleUrl = "https://forum.wownero.com/t/how-to-install-wonerujo-android-wallet/358";
@ -239,12 +229,11 @@ public class Responses {
return createMessageEmbed(embedTitle, embedTitleUrl, description, imgUrl, WOWNERO_PINK);
}
public MessageEmbed paperReply() {
final String embedTitle = "Paper Wowlet";
final String embedTitleUrl = "https://gitlab.com/simpilldev/discord-monerochan-bot/-/blob/master/guides/paperwalletguide.md";
final String description = """
A paper wowlet is a piece of paper that contains your public and private keys, usually in plain text or as a QR code.
A paper wowlet is a piece of paper that contains your public and private keys, usually in plain text or as a QR code.
Here's a guide I wrote on creating paper wallets for Monero (same applies for Wownero):

@ -25,6 +25,8 @@ public class WowneroChanBot {
.enableIntents(GatewayIntent.GUILD_MEMBERS)
.addEventListeners(new Commands(), new MemberJoinResponse(), new ServerJoinResponse())
.build();
new Memes().getRandomMeme();
}
}

Loading…
Cancel
Save