当前位置: 首页>>代码示例>>Java>>正文


Java TextChannel.getName方法代码示例

本文整理汇总了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);
}
 
开发者ID:thebrightspark,项目名称:MDC-Discord-Bot,代码行数:48,代码来源:AutomodListener.java

示例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;
}
 
开发者ID:paul-io,项目名称:momo-2,代码行数:6,代码来源:SparkTwitchBean.java


注:本文中的net.dv8tion.jda.core.entities.TextChannel.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。