Example #1
0
 @Override
 public void onCommand(Chat chat, User sender, String[] args) throws Exception {
   if (args.length == 0) {
     chat.send("Usage: !addcontact <user>");
     return;
   }
   if (Permissions.hasPermission(sender, chat, "add")) {
     add(args[0]);
     chat.send("Successfully added " + args[0]);
   } else {
     chat.send("You don't have permission! :P");
   }
   add(s);
 }
Example #2
0
 @Override
 public void onMessage(
     String channel, String sender, String login, String hostname, String message) {
   if (uhcChat == null) {
     return;
   }
   if (message.startsWith("# ")) {
     return;
   }
   try {
     uhcChat.send(">" + sender + ": " + message);
   } catch (SkypeException e) {
     SkypeBot.log("Could not send message! (Not hooked into Skype?");
   }
   if (message.startsWith(SkypeBot.getSettingValue("commandPrefix"))) {
     String[] splitMessage = message.split(" ");
     String[] parameters = Arrays.copyOfRange(splitMessage, 1, splitMessage.length);
     String command = splitMessage[0].replaceFirst(SkypeBot.getSettingValue("commandPrefix"), "");
     CommandContainer cc = new CommandContainer(parameters, sender, command, uhcChat);
     SkypeBot.cmds().executeCommand(cc);
   }
 }