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


Java GenericMessageEvent.respond方法代码示例

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


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

示例1: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage (GenericMessageEvent e) {

    String sender = e.getUser().getNick();

    // send a test message
    if (e.getMessage().equalsIgnoreCase(prefix + "test")) {
        e.respond("Ciao bello! ;-)");
    }

    //whoami
    if (e.getMessage().equalsIgnoreCase(prefix + "whoami")) {
        e.respond("You are " + sender + ", indeed!");
    }

    //write a test .property file to find out where it goes
    if (e.getMessage().equalsIgnoreCase(prefix + "writetest")) {
        if (sender.equals(masterUser)) {
            e.respond("Writing a " + CONFIG_FILE + "...");
            utils.writeProperty("test", "I'm a test");
            e.respond("Done!");
        } else { e.respond("Access denied!"); }
    }

}
 
开发者ID:Walkersneps,项目名称:SnepsBotX,代码行数:26,代码来源:TestCommands.java

示例2: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage (GenericMessageEvent e) {

    String sender = e.getUser().getNick();

    //stalk cycle
    if (canStalk) {
        String senderup = sender.toUpperCase();
        //System.out.println("Uppercase sender nick is: " + senderup);
        if (stalkingPeople.contains(senderup)) {
            System.out.println("extracting stalkSentence...");
            String stalkSentence = nextSentence();
            e.respond(stalkSentence);
        }
    }

}
 
开发者ID:Walkersneps,项目名称:SnepsBotX,代码行数:18,代码来源:StalkCycle.java

示例3: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage (GenericMessageEvent e) throws Exception {

    String message = e.getMessage();

    if (message.startsWith(prefix + "chat ")) {
        String mode = message.split(" ") [1];

        if (mode.equalsIgnoreCase("on")) {
            canChat = true;
            e.respond("I can now chat! How lovely :)");
        } else if (mode.equalsIgnoreCase("off")) {
            canChat = false;
            e.respond("Ok, so you want me to shut up?! Oh, what the fuck you little bitch!");
        }
    }


}
 
开发者ID:Walkersneps,项目名称:SnepsBotX,代码行数:20,代码来源:ChatToggle.java

示例4: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage(final GenericMessageEvent event) throws Exception {

    if (event.getMessage().startsWith(m_command)) {
        if(PermissionHelper.HasPermissionFromList(m_neededPermissions, event.getUser().getNick())) {

            if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 0)) {
                event.respond("HalGNU V1.0 - Daisy");
            } else {
                event.respond("Ex: " + m_command + "");
            }
        } else {
            event.respond("Permission denied");
        }
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:17,代码来源:VersionListener.java

示例5: handleReadTwitterCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
public void handleReadTwitterCommand(GenericMessageEvent event) {
        if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 1)) {
            String check = CommandHelper.removeCommandFromString(event.getMessage()).trim();
            try {
                MemberModel memberModel = DatabaseManager.getInstance().getMemberByUsername(check);
                if (memberModel != null) {
                    event.respond(memberModel.getUserName()+"'s twitter handle is: "
                            +memberModel.getTwitterHandle()+" ");
                } else {
                    event.respond("No record found.");
                }
            } catch (SQLException e) {
                e.printStackTrace();
                event.respond("No record found.");
            }
        } else {
            event.respond("Ex. "+ m_readTwitter +" <user>");
        }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:20,代码来源:TwitterHandleListener.java

示例6: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
    checkIfUrl(event.getMessage());
    if (event.getMessage().startsWith(m_command)) {
        if(PermissionHelper.HasPermissionFromList(m_neededPermissions, event.getUser().getNick())) {

            if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 0)) {

                event.respond(getTitle());

            } else {

                event.respond("Ex: " + m_command + "");
            }
        } else {
            event.respond("Permission denied");
        }
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:20,代码来源:WebsiteHeaderListener.java

示例7: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage(final GenericMessageEvent event) throws Exception {

    if (event.getMessage().startsWith(m_command)) {
        if(PermissionHelper.HasPermissionFromList(m_neededPermissions, event.getUser().getNick())) {

            if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 0)) {

                event.respond("Current Date/Time: " + getDateTime());
            } else {
                event.respond("Ex: " + m_command + "");
            }
        } else {
            event.respond("Permission denied");
        }
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:18,代码来源:TimeListener.java

示例8: handleLastSeenCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
public void handleLastSeenCommand(GenericMessageEvent event) {
    if (PermissionHelper.HasPermissionFromList(m_lastSeenNeededPermissions, event.getUser().getNick())) {
        if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 1)) {
            String check = CommandHelper.removeCommandFromString(event.getMessage()).trim();
            try {
                ActivityModel activityModel = DatabaseManager.getInstance().getActivityByUsername(check);
                if (activityModel != null) {
                    event.respond(activityModel.getLastActive()+" :<"
                            +activityModel.getUsername()+"> " + activityModel.getLastMessage());
                } else {
                    event.respond("No record found.");
                }
            } catch (SQLException e) {
                e.printStackTrace();
                event.respond("No record found.");
            }

        } else {
            event.respond("Ex. "+ m_lastSeenCommand +" <user>");
        }
    } else {
        event.respond("Permission denied");
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:25,代码来源:ActivityListener.java

示例9: onGenericMessage

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
    if (event.getMessage().startsWith(m_command)) {
        if (PermissionHelper.HasPermissionFromList(m_neededPermissions, event.getUser().getNick())) {

            if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 1)) {
                int saying = randInt(0,m_shameSayings.length - 1);
                String target = CommandHelper.removeCommandFromString(event.getMessage());
                event.getBot().sendIRC().message(ConfigManager.getInstance().getIrcChannel(),
                        m_shameSayings[saying].replace("%XXXX%", target));

            } else {
                event.respond("Ex. "+m_command+" <user>");
            }
        } else {
            event.respond("Permission Denied");
        }
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:20,代码来源:ShameListener.java

示例10: handleRemoveMemberCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
private void handleRemoveMemberCommand(GenericMessageEvent event) {
    if(PermissionHelper.HasPermissionFromList(m_neededRemoveMemberPermissions, event.getUser().getNick())) {
        if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 1)) {
            try {
                MemberModel member = DatabaseManager.getInstance().getMemberByUsername(CommandHelper.removeCommandFromString(event.getMessage()).trim());
                if (member != null) {
                    DatabaseManager.getInstance().getMemberDao().delete(member);
                    event.respond("User removed from database");
                    AdminCmdHelper.kickUserFromRoom(CommandHelper.removeCommandFromString(event.getMessage()).trim(), "Membership_Revoked");
                    
                } else {
                    event.respond("User does not exist");
                }
            } catch (SQLException e) {
                event.respond("User does not exist");
            }
        } else {
            event.respond("Ex: " + m_removeMemberCommand + " <user>");
        }
    } else {
        event.respond("Permission denied");
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:24,代码来源:BouncerListener.java

示例11: handleEnforceCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
private void handleEnforceCommand(GenericMessageEvent event) {
    int numKicked = 0;

    if(PermissionHelper.HasPermissionFromList(m_neededEnforcePermissions, event.getUser().getNick())) {
        if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 0)) {

            m_enforce = !m_enforce;

            if(m_enforce) {
                event.respond("Activating enforcement mode");

                event.respond("Scanning room");
                doEnforcmentCheck(event);
                event.respond("Scan complete");

            } else {
                event.respond("Deactivating enforcement mode");
            }
        }
    } else {
        event.respond("Permission denied");
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:24,代码来源:BouncerListener.java

示例12: handleInviteCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
private void handleInviteCommand(GenericMessageEvent event) {
    if(PermissionHelper.HasPermissionFromList(m_neededInvitePermissions, event.getUser().getNick())) {
        if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 1)) {
            if(DatabaseManager.getInstance().createMember(CommandHelper.removeCommandFromString(event.getMessage()).trim()
                    ,event.getUser().getNick())) {
                event.respond("User added to registry");
            } else {
                event.respond("User already in registry");
            }
        } else {
            event.respond("Ex: " + m_inviteCommand + " <usernamehere>");
        }
    } else {
        event.respond("Permission denied");
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:17,代码来源:BouncerListener.java

示例13: handleWhoInvitedCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
private void handleWhoInvitedCommand(GenericMessageEvent event) {
    if(PermissionHelper.HasPermissionFromList(m_neededWhoInvitedPermissions, event.getUser().getNick())) {

        if (CommandHelper.checkForAmountOfArgs(event.getMessage(), 1)) {
            MemberModel member = null;
            try {
                member = DatabaseManager.getInstance()
                        .getMemberByUsername(CommandHelper.removeCommandFromString(event.getMessage()).trim());

                if(member != null) {
                    event.respond(member.getInvitedBy() + " invited " + member.getUserName() + " on " + member.getDateInvited());
                } else {
                    event.respond("User not in registry");
                }
            } catch (SQLException e) {
                e.printStackTrace();
                event.respond("User not in registry");
            }
        } else {
            event.respond("Ex: " + m_whoInvitedCommand + " <usernamehere>");
        }
    } else {
        event.respond("Permission denied");
    }
}
 
开发者ID:R4stl1n,项目名称:halgnu,代码行数:26,代码来源:BouncerListener.java

示例14: onCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onCommand(GenericMessageEvent event, CallInfo callInfo, String[] args) {
    if (args.length < 1) {
        notice(event, "Not enough arguments.");
        return;
    }
    boolean status;
    try {
        String content = BotUtils.getContent(String.format("https://minecraft.net/haspaid.jsp?user=%s", URLEncoder.encode(args[0], "UTF-8")));
        status = content.equalsIgnoreCase("true");
    } catch (Exception e) {
        notice(event, BotUtils.formatException(e));
        return;
    }
    event.respond(args[0] + " has " + Colors.BOLD + ((status) ? "" : "not ") + "paid" + Colors.NORMAL + " for Minecraft.");
}
 
开发者ID:RoyalDev,项目名称:RoyalBot,代码行数:17,代码来源:MCAccountCommand.java

示例15: onCommand

import org.pircbotx.hooks.types.GenericMessageEvent; //导入方法依赖的package包/类
@Override
public void onCommand(GenericMessageEvent event, CallInfo callInfo, String[] args) {
    if (args.length < 1) {
        notice(event, "Not enough arguments.");
        return;
    }
    final int port;
    try {
        port = (args.length > 1) ? Integer.valueOf(args[1]) : 25565;
    } catch (NumberFormatException e) {
        notice(event, BotUtils.formatException(e));
        return;
    }
    final MinecraftPingReply mpr = new MinecraftPing().getPing(args[0], port);
    if (mpr == null) {
        notice(event, "Server appears to be down.");
        return;
    }
    event.respond(mpr.getMotd() + " - " + mpr.getOnlinePlayers() + "/" + mpr.getMaxPlayers() + " players, " + mpr.getVersion());
}
 
开发者ID:RoyalDev,项目名称:RoyalBot,代码行数:21,代码来源:MCPingCommand.java


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