blob: 892ca15173d6702bcbd945af980c7f1feb3218f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package de.romjaki.selfbot;
import net.dv8tion.jda.core.entities.TextChannel;
import org.jetbrains.annotations.Contract;
/**
* Created by RGR on 19.05.2017.
*/
public class Util {
@Contract(value = " -> fail", pure = true)
private Util() {
Util.singleton(Util.class);
}
@Contract(pure = true, value = "_ -> fail")
public static void singleton(Class<?> clazz) {
throw new Error("No " + clazz.toGenericString() + " instances for you!");
}
@Contract(pure = true, value = "null -> fail")
public static boolean isBotChannel(TextChannel channel) {
return channel.getName().toLowerCase().contains("bot");
}
@Contract(pure = true, value = "null -> fail ; !null -> !null")
public static String escape(String join) {
return join.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n").replace("\t", "\\t");
}
public static int clamp(int min, int max, int val) {
return val < min ? min : (val > max ? max : val);
}
}
|