Bot announces when new cards are available in the database / when

database updates have occurred.
This commit is contained in:
sigonasr2 2018-11-20 22:07:05 -06:00
parent 250c41d0cf
commit fb63b2644f
3 changed files with 16 additions and 2 deletions

Binary file not shown.

View File

@ -401,6 +401,11 @@ public class BandoriBot extends ListenerAdapter{
System.out.println("Channel "+channel+": "+user+" - "+message); System.out.println("Channel "+channel+": "+user+" - "+message);
if (user.getUser().getIdLong()==494666451765035009l) { if (user.getUser().getIdLong()==494666451765035009l) {
if (channel.getId().equalsIgnoreCase("509845287284768801")) {
if (message.contains("new cards are now available! Good Luck!")) {
messaging_channel.pinMessageById(ev.getMessageId()).queue();
}
}
return; return;
} }

View File

@ -27,6 +27,7 @@ import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.MessageBuilder; import net.dv8tion.jda.core.MessageBuilder;
import net.dv8tion.jda.core.entities.Message; import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.MessageChannel; import net.dv8tion.jda.core.entities.MessageChannel;
import net.dv8tion.jda.core.requests.restaction.MessageAction;
import sig.gacha.Card; import sig.gacha.Card;
import sig.gacha.Member; import sig.gacha.Member;
import sig.gacha.Player; import sig.gacha.Player;
@ -35,7 +36,8 @@ public class GachaBot {
JDA bot; JDA bot;
static int cardcount = 0; static int cardcount = 0;
static int membercount = 0; static int membercount = 0;
public static int databasecheck = 86400; public static int databasecheck = 21400;
static boolean initialcheck=false;
public static HashMap<Integer,Member> memberlist = new HashMap<Integer,Member>(); public static HashMap<Integer,Member> memberlist = new HashMap<Integer,Member>();
public static HashMap<Integer,Card> card_idmap = new HashMap<Integer,Card>(); public static HashMap<Integer,Card> card_idmap = new HashMap<Integer,Card>();
public static HashMap<Integer,List<Card>> card_raritymap = new HashMap<Integer,List<Card>>(); public static HashMap<Integer,List<Card>> card_raritymap = new HashMap<Integer,List<Card>>();
@ -348,8 +350,8 @@ public class GachaBot {
if (!memberlist.containsKey(m.getMemberID())) { if (!memberlist.containsKey(m.getMemberID())) {
memberlist.put(m.getMemberID(),m); memberlist.put(m.getMemberID(),m);
membercount++; membercount++;
membersLoaded++;
} }
membersLoaded++;
} }
if (nexturl.length()==0) { if (nexturl.length()==0) {
break; break;
@ -359,5 +361,12 @@ public class GachaBot {
} catch (JSONException | IOException e) { } catch (JSONException | IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if (!initialcheck) {
initialcheck=true;
} else {
if (cardsLoaded>0) {
BandoriBot.bot.getTextChannelById(509845287284768801l).sendMessage("**"+cardsLoaded+" new cards are now available! Good Luck!** ("+(Card.star2total+Card.star3total+Card.star4total)+" total)").queue();
}
}
} }
} }