本文整理汇总了Java中net.dv8tion.jda.core.entities.TextChannel.getName方法的典型用法代码示例。如果您正苦于以下问题:Java TextChannel.getName方法的具体用法?Java TextChannel.getName怎么用?Java TextChannel.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.entities.TextChannel
的用法示例。
在下文中一共展示了TextChannel.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGuildMessageReceived
import net.dv8tion.jda.core.entities.TextChannel; //导入方法依赖的package包/类
@Override
public void onGuildMessageReceived(GuildMessageReceivedEvent event)
{
//TODO: Automod!
/*
Want the following:
* Configurable auto deleting of links and file uploads
* Whitelist/Blacklist for links and bad words
* Regex on bad words (print to the log what words were matched in the message
* Configurable muting when someone's done bad enough things:
* Posted too many bad words within X time (default 5mins?)
* Posted too many messages (configurable) within X time (default 5 messages in 2s?)
* Posted too many duplicate characters in a message (default >60% similar characters in a message?)
*/
Message message = event.getMessage();
User author = message.getAuthor();
//Ignore Admins and Moderators
if(MDCBot.isMemberBotModerator(event.getGuild().getMember(author)))
return;
String content = message.getContent();
TextChannel channel = event.getChannel();
String channelName = channel.getName();
if(checkLinks(channelName, message))
deleteMessage(message, "Deleted message containing link from member %s (%s) in %s (%s):%s", author.getAsMention(), author.getName(), channel.getAsMention(), channelName, content);
if(checkFiles(channelName, message))
{
StringBuilder sb = new StringBuilder();
for(Message.Attachment a : message.getAttachments())
sb.append("\n").append(a.getUrl());
deleteMessage(message, "Deleted file posted by member %s (%s) in %s (%s):%s", author.getAsMention(), author.getName(), channel.getAsMention(), channelName, sb.toString());
}
if(checkSpamCharacters(channelName, content))
deleteMessage(message, "Deleted message containing spammed characters from member %s (%s) in %s (%s):%s", author.getAsMention(), author.getName(), channel.getAsMention(), channelName, content);
if(checkSpamMessages(channelName, message))
for(Message m : messageSpamCache.get(author.getIdLong()))
deleteMessage(m, "Deleted message due to spam from member %s (%s) in %s (%s):%s", author.getAsMention(), author.getName(), channel.getAsMention(), channelName, m.getContent());
if(checkBadWords(channelName, content))
deleteMessage(message, "Deleted message due to bad words from member %s (%s) in %s (%s):%s", author.getAsMention(), author.getName(), channel.getAsMention(), channelName, content);
}
示例2: SparkTwitchBean
import net.dv8tion.jda.core.entities.TextChannel; //导入方法依赖的package包/类
private SparkTwitchBean(TextChannel ch, String twitchHandle) {
this.channelId = ch.getId();
this.channelName = ch.getName();
this.twitchHandle = twitchHandle;
}