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


Java Chattable.send方法代码示例

本文整理汇总了Java中com.sorcix.sirc.util.Chattable.send方法的典型用法代码示例。如果您正苦于以下问题:Java Chattable.send方法的具体用法?Java Chattable.send怎么用?Java Chattable.send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sorcix.sirc.util.Chattable的用法示例。


在下文中一共展示了Chattable.send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendOnlineAdmins

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
private void sendOnlineAdmins(Chattable target) {
    target.send("Online admins:");
    StringBuilder builder = new StringBuilder();
    int count = 0;
    for (String admin : bot.getAdmins().getAdmins()) {
        if (bot.getAuth().isAuthenticated(bot.getConnection().createUser(admin))) {
            if (count > 0) {
                builder.append(", ");
            } else {
                builder.append("  ");
            }
            builder.append(admin);
            count++;
        }
    }
    String onlineString = builder.toString();
    if (onlineString.isEmpty()) {
        onlineString = "  No admins are online :(";
    }
    target.send(onlineString);
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:22,代码来源:CommandAdmins.java

示例2: sendRegisteredAdmins

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
private void sendRegisteredAdmins(Chattable target) {
    target.send("Registered admins:");
    StringBuilder builder = new StringBuilder();
    int count = 0;
    for (String admin : bot.getAdmins().getAdmins()) {
        if (count > 0) {
            builder.append(", ");
        } else {
            builder.append("  ");
        }
        builder.append(admin);
        count++;
    }
    String registeredString = builder.toString();
    if (registeredString.isEmpty()) {
        registeredString = "  No admins are registered :(";
    }
    target.send(registeredString);
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:20,代码来源:CommandAdmins.java

示例3: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    if (command.hasArgs()) {
        String channelName = getChannelName(command.args.toLowerCase());
        Map<String, Channel> channelMap = bot.getConnection().getState().getChannelMap();
        if (channelMap.containsKey(channelName)) {
            target.send("Left channel \"" + channelName + "\".");
            channelMap.get(channelName).part();
            return true;
        } else {
            target.send(colorRed("I'm not connected to \"" + channelName + "\"!"));
            return false;
        }
    } else {
        target.send("Bye :(");
        channel.part();
        return true;
    }
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:20,代码来源:CommandLeave.java

示例4: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    target.send("Blacklisted users:");
    Set<String> blacklist = bot.getBlacklist().getBlacklistedUsers();
    int count = 0;
    StringBuilder builder = new StringBuilder(20);
    for (String str : blacklist) {
        if (count > 0) {
            builder.append(", ");
        } else {
            builder.append("  ");
        }
        builder.append(str);
        count++;
        if (count >= 10) {
            target.send(builder.toString());
            builder = new StringBuilder(20);
            count = 0;
        }
    }
    String lastLine = builder.toString();
    if (!lastLine.isEmpty()) {
        target.send(colorGreen(lastLine));
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:27,代码来源:CommandListBlacklist.java

示例5: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    target.send(bot.getVersionString() + " status:");
    target.send("  " + bot.getCommandManager().getCommandNameMap().size() + " loaded commands with " + bot.getCommandManager().getCommandMap().size() + " registered aliases.");
    target.send("  Memory: " + (Runtime.getRuntime().freeMemory() / 1000000) + "mb used / " + (Runtime.getRuntime().totalMemory() / 1000000) + "mb allocated / " + (Runtime.getRuntime().maxMemory() / 1000000) + "mb available.");
    PluginList plugins = bot.getPluginList();
    StringBuilder builder = new StringBuilder(plugins.size() * 2);
    int count = 0;
    for (IrcPlugin plugin : plugins.getPlugins()) {
        if (count > 0) {
            builder.append(", ");
        }
        builder.append(plugin.getID());
        count++;
    }
    target.send("  Plugins (" + plugins.size()  + "): " + builder.toString());
    target.send("  Uptime: " + calcUptime());
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:20,代码来源:CommandStatus.java

示例6: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    target.send("Whitelisted users:");
    Set<String> whitelist = bot.getBlacklist().getWhitelistedUsers();
    int count = 0;
    StringBuilder builder = new StringBuilder(20);
    for (String str : whitelist) {
        if (count > 0) {
            builder.append(", ");
        } else {
            builder.append("  ");
        }
        builder.append(str);
        count++;
        if (count >= 10) {
            target.send(builder.toString());
            builder = new StringBuilder(20);
            count = 0;
        }
    }
    String lastLine = builder.toString();
    if (!lastLine.isEmpty()) {
        target.send(colorGreen(lastLine));
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:27,代码来源:CommandListWhitelist.java

示例7: sendFormattedString

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
public boolean sendFormattedString(String str, Chattable target, String prefix, boolean filter) {
    str = filter ? filterString(str) : str;
    if (str != null) {
        String[] lines = str.split(Patterns.NEWLINE);
        if (lines.length <= 5 || !filter) {
            for (String line : lines) {
                if (line.length() > 400 && filter) {
                    target.send("Output was too long, so it has been truncated.");
                    line = line.substring(0, 397).concat("...");
                }
                target.send(prefix + line);
            }
        } else {
            target.send("Output had too many lines, so newlines were replaced with \"▼\".");
            if (str.length() > 400) {
                target.send("Output was too long, so it has been truncated.");
                str = str.substring(0, 397).concat("...");
            }
            target.send(prefix + str.replace("\n", "▼"));
        }
    }
    return false;
}
 
开发者ID:warriordog,项目名称:acomputerbot,代码行数:24,代码来源:StringCheck.java

示例8: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User user, Chattable chattable, CommandLine commandLine) {
    StringBuilder drama = new StringBuilder();
    drama.append(randomItem(people));
    drama.append(' ');
    drama.append(randomItem(actions));
    drama.append(' ');
    drama.append(randomItem(targets));
    if (random.nextBoolean()) {
        drama.append(" and ");
        drama.append(randomItem(results));
    }
    chattable.send(drama.toString());
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_mclib,代码行数:16,代码来源:CommandDrama.java

示例9: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    User user = bot.getConnection().createUser(command.args);
    if (bot.getBlacklist().isWhitelisted(user)) {
        bot.getBlacklist().removeWhitelisted(user);
        target.send("User " + user.getNick() + " has been un-whitelisted.");
    } else {
        bot.getBlacklist().addWhitelisted(user);
        target.send("User " + user.getNick() + " has been whitelisted.");
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:13,代码来源:CommandWhitelist.java

示例10: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    if (Config.ENABLE_WHITELIST) {
        Config.ENABLE_WHITELIST = false;
        target.send("Whitelist disabled.");
    } else {
        Config.ENABLE_WHITELIST = true;
        target.send("Whitelist enabled.");
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:12,代码来源:CommandToggleWhitelist.java

示例11: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User user, Chattable chattable, CommandLine commandLine) {
    PluginList plugins = bot.getPluginList();
    chattable.send(plugins.size() + " loaded plugins:");
    for (IrcPlugin plugin : plugins.getPlugins()) {
        chattable.send(plugin.getName() + ' ' + plugin.getVersion() + " (" + plugin.getID() + " / " + plugin.getClass().getName() + ')');
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:10,代码来源:CommandPlugins.java

示例12: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    if (bot.getAuth().deauthenticate(sender)) {
        target.send("You have been successfully logged out!");
        return true;
    } else {
        target.send(colorRed("You are not logged in!"));
        return false;
    }
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:11,代码来源:CommandLogout.java

示例13: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    target.send("Connected channels:");
    Map<String, Channel> channelMap = bot.getConnection().getState().getChannelMap();
    for (String chan : channelMap.keySet()) {
        String topic = channelMap.get(chan).getTopic();
        target.send("  " + chan + (topic == null ? "" : ": " + topic));
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:11,代码来源:CommandChannels.java

示例14: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    target.send("Bye bye!");
    if (command.hasArgs()) {
        bot.stop(command.args);
    } else {
        bot.stop();
    }
    return true;
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:11,代码来源:CommandStop.java

示例15: processCommand

import com.sorcix.sirc.util.Chattable; //导入方法依赖的package包/类
@Override
public boolean processCommand(Channel channel, User sender, Chattable target, CommandLine command) {
    String channelName = command.args.toLowerCase();
    Map<String, Channel> channelMap = bot.getConnection().getState().getChannelMap();
    if (!channelMap.containsKey(channelName)) {
        Channel chan = bot.getConnection().createChannel(channelName);
        chan.join();
        target.send("Joined \"" + channelName + "\".");
        return true;
    } else {
        target.send(colorRed("Already connected to \"" + channelName + "\"!"));
        return false;
    }
}
 
开发者ID:warriordog,项目名称:acomputerbot_corelib,代码行数:15,代码来源:CommandJoin.java


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