Skip to content

Commit

Permalink
Merge branch 'master' into beanlotteryFix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazawrath authored Feb 1, 2019
2 parents 60ff66f + ab5994c commit a870155
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.mazawrath.beanbot.utilities;

import java.net.URL;
import java.util.Random;

public class LivestreamNotification {
private String userId;
Expand All @@ -16,7 +16,7 @@ public LivestreamNotification(String userId, String userName, String title, Stri
this.title = title;
this.gameId = gameId;
this.viewerCount = viewerCount;
this.thumbnail = thumbnail.replace("{width}x{height}", "1920x1080");
this.thumbnail = thumbnail.replace("{width}x{height}", "1920x1080") + "?rnd=" + randomPasswordGenerator(6);
}

String getUserId() {
Expand All @@ -42,4 +42,32 @@ int getViewerCount() {
String getThumbnail() {
return thumbnail;
}

private String randomPasswordGenerator(int passwordLength) {
// A strong password has Cap_chars, Lower_chars,
// numeric value and symbols. So we are using all of
// them to generate our password
String Capital_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String Small_chars = "abcdefghijklmnopqrstuvwxyz";
String numbers = "0123456789";
//String symbols = "!@#$%^&*_=+-/.?<>)";


String values = Capital_chars + Small_chars +
numbers;

// Using random method
Random random_method = new Random();

char[] password = new char[passwordLength];

for (int i = 0; i < passwordLength; i++) {
// Use of charAt() method : to get character value
// Use of nextInt() as it is scanning the value as int
password[i] =
values.charAt(random_method.nextInt(values.length()));

}
return String.valueOf(password);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/mazawrath/beanbot/utilities/Lottery.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class Lottery {
public static final int AMOUNT_DRAWN = 3;
public static final int MIN_NUMBER = 1;
public static final int MAX_NUMBER = 20;
public static final int MAX_NUMBER = 40;
public static final BigDecimal MIN_WEEKLY_VALUE = new BigDecimal(50000);
private static final String DB_NAME = "beanBotLottery";

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mazawrath/beanbot/utilities/Points.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Points {
public static final BigDecimal FREE_POINTS = new BigDecimal("25.69").setScale(SCALE, ROUNDING_MODE);
public static final BigDecimal COMMAND_COST = new BigDecimal("2.00").setScale(SCALE, ROUNDING_MODE);
public static final BigDecimal COMMAND_COST_SPECIAL = new BigDecimal("10.00").setScale(SCALE, ROUNDING_MODE);
public static final BigDecimal LOTTERY_TICKET_COST = new BigDecimal("20.00").setScale(SCALE, ROUNDING_MODE);
public static final BigDecimal LOTTERY_TICKET_COST = new BigDecimal("40.00").setScale(SCALE, ROUNDING_MODE);
public static final BigDecimal LOTTERY_DRAWING_COST = new BigDecimal("20000.00").setScale(SCALE, ROUNDING_MODE);
public static final BigDecimal GOOGLE_VISION_COST = new BigDecimal("50.00").setScale(SCALE, ROUNDING_MODE);
private Connection conn;
Expand Down

0 comments on commit a870155

Please sign in to comment.