mirror of
https://github.com/sciwhiz12/Janitor.git
synced 2024-11-10 03:21:26 +00:00
Add forgotten change, whoops
This commit is contained in:
parent
de696c0e12
commit
eff4beb049
|
@ -1,6 +1,6 @@
|
|||
package sciwhiz12.janitor.utils;
|
||||
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.*;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -14,7 +14,31 @@ public class Util {
|
|||
}
|
||||
|
||||
public static String toString(final User user) {
|
||||
return String.format("<%s#%s:%s>", user.getName(), user.getDiscriminator(), user.getId());
|
||||
return String.format("{User,%s#%s}:%s", user.getName(), user.getDiscriminator(), getID(user));
|
||||
}
|
||||
|
||||
public static String toString(final MessageChannel channel) {
|
||||
if (channel instanceof GuildChannel) {
|
||||
GuildChannel gc = (GuildChannel) channel;
|
||||
return String.format("[Channel:%s,%s@%s]%s", gc.getType(), gc.getName(), toString(gc.getGuild()), getID(channel));
|
||||
}
|
||||
return String.format("[Channel:%s,%s]:%s", channel.getType(), channel.getName(), getID(channel));
|
||||
}
|
||||
|
||||
public static String toString(final Guild guild) {
|
||||
return String.format("(Guild:%s):%s", guild.getName(), getID(guild));
|
||||
}
|
||||
|
||||
public static String getID(final ISnowflake snowflake) {
|
||||
String prefix = "?";
|
||||
if (snowflake instanceof User) {
|
||||
prefix = "@&";
|
||||
} else if (snowflake instanceof Role) {
|
||||
prefix = "@!";
|
||||
} else if (snowflake instanceof MessageChannel) {
|
||||
prefix = "#";
|
||||
}
|
||||
return String.format("<%s%s>", prefix, snowflake.getIdLong());
|
||||
}
|
||||
|
||||
public static <Success, Error> BiConsumer<Success, Error> handle(final Consumer<Success> success,
|
||||
|
|
Loading…
Reference in New Issue
Block a user