2024-06-24 16:42:57 +00:00
|
|
|
package cc.fascinated.bat.common;
|
|
|
|
|
|
|
|
import cc.fascinated.bat.service.DiscordService;
|
2024-06-25 10:14:12 +00:00
|
|
|
import lombok.experimental.UtilityClass;
|
2024-06-24 16:42:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Fascinated (fascinated7)
|
|
|
|
*/
|
2024-06-25 10:14:12 +00:00
|
|
|
@UtilityClass
|
2024-06-24 16:42:57 +00:00
|
|
|
public class TextChannelUtils {
|
|
|
|
/**
|
|
|
|
* Checks if a channel is valid
|
|
|
|
*
|
|
|
|
* @param id the id of the channel
|
|
|
|
* @return if the channel is valid
|
|
|
|
*/
|
|
|
|
public static boolean isValidChannel(String id) {
|
|
|
|
if (id == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return DiscordService.JDA.getTextChannelById(id) != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the mention of a channel
|
|
|
|
*
|
|
|
|
* @param id the id of the channel
|
|
|
|
* @return the mention of the channel
|
|
|
|
*/
|
|
|
|
public static String getChannelMention(String id) {
|
|
|
|
return "<#" + id + ">";
|
|
|
|
}
|
|
|
|
}
|