本文整理汇总了Java中net.dv8tion.jda.entities.TextChannel.getId方法的典型用法代码示例。如果您正苦于以下问题:Java TextChannel.getId方法的具体用法?Java TextChannel.getId怎么用?Java TextChannel.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.entities.TextChannel
的用法示例。
在下文中一共展示了TextChannel.getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import net.dv8tion.jda.entities.TextChannel; //导入方法依赖的package包/类
@Override
protected boolean execute(Object[] args, MessageReceivedEvent event) {
TextChannel tchan = (TextChannel)(args[0]);
String options = args[1]==null ? "" : (String)args[1];
if(tchan==null)
tchan = event.getTextChannel();
//check bot permissions for channel
if(!PermissionUtil.checkPermission(event.getJDA().getSelfInfo(), Permission.MESSAGE_WRITE, tchan) || !PermissionUtil.checkPermission(event.getJDA().getSelfInfo(), Permission.MESSAGE_READ, tchan))
{
Sender.sendResponse(String.format(SpConst.NEED_PERMISSION,Permission.MESSAGE_READ+", "+Permission.MESSAGE_WRITE+
", and preferably "+Permission.MESSAGE_ATTACH_FILES), event);
return false;
}
String str = "";
String[] current = feeds.feedForGuild(event.getGuild(), Feeds.Type.MODLOG);
if(current!=null)
str+=SpConst.WARNING+"Feed "+Feeds.Type.MODLOG+" has been removed from <#"+current[Feeds.CHANNELID]+">\n";
feeds.set(new String[]{tchan.getId(),Feeds.Type.MODLOG.toString(),event.getGuild().getId(),options});
str+=SpConst.SUCCESS+"Feed "+Feeds.Type.MODLOG+" has been added to <#"+tchan.getId()+">"
+ "\n*The `modlog` feed is for tracking bans, and other moderator commands like kicks, mutes, and cleans*"
+ "\n*If you want a feed to track message edits, message deletes, avatar changes, and more, use the `serverlog` feed.*";
Sender.sendResponse(str, event);
return true;
}
示例2: execute
import net.dv8tion.jda.entities.TextChannel; //导入方法依赖的package包/类
@Override
protected boolean execute(Object[] args, MessageReceivedEvent event) {
TextChannel channel = (TextChannel)(args[0]);
if(channel==null)
channel = event.getTextChannel();
String info = "\uD83D\uDCFA Information about <#"+channel.getId()+">\n";
info += SpConst.LINESTART+"Server: **"+event.getGuild().getName()+"**\n";
info += SpConst.LINESTART+"Channel ID: **"+channel.getId()+"**\n";
info += SpConst.LINESTART+"Creation: **"+MiscUtil.getCreationTime(channel.getId()).format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**\n";
info += SpConst.LINESTART+"Num Users: **"+channel.getUsers().size()+"**";
if(channel.getTopic()!=null && !channel.getTopic().trim().equals(""))
info += "\n"+SpConst.LINESTART+"__**Topic**__:\n"+FormatUtil.demention(channel.getTopic());
Sender.sendResponse(info, event);
return true;
}