本文整理匯總了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;
}