• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SkypeException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.skype.SkypeException的典型用法代码示例。如果您正苦于以下问题:Java SkypeException类的具体用法?Java SkypeException怎么用?Java SkypeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: main

import com.skype.SkypeException; //导入依赖的package包/类
/**
 * Registers {@link GroupChatAdderListener} in order to be able to add listener
 * in chats.
 */
public static void main(String[] args) {

	try { // Set system's look and feel
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	} catch (Exception e) {
		new WarningPopup("Can't find system's look and feel");
	}

	Config.initate();

	try {
		Skype.addChatMessageListener(new GroupChatAdderListener());
	} catch (SkypeException e1) {
		new ErrorPopup("Can not connect with skype.");
	}
	
	frame.add(label);
	frame.setSize(666, 333);
	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:27,代码来源:Main.java


示例2: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws CommandException {
	if (outputChat == null)
		throw new NullOutputChatException("Empty output chat.");

	try {

		if (id.equals("")) {
			outputChat.send(getSyntax());
			return;
		}

		if (currentAdmins.add(id))
			outputChat.send("Admin successfully added");
		else
			outputChat.send("All ready exists.");
	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}

}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:22,代码来源:CommandAddAdmin.java


示例3: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws NullOutputChatException {

	if (outputChat == null)
		throw new NullOutputChatException("Empty output chat.");

	try {

		if (userInfo != null)
			outputChat.send(printInfo());
		else
			outputChat.send(getSyntax());

	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:18,代码来源:CommandInfo.java


示例4: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws CommandException {
	if (outputChat == null)
		throw new NullOutputChatException("Empty output chat.");

	try {
		String result = commandInformations
			.get(commandNameToFindHelp.toLowerCase());

		if (result == null)
			outputChat.send(getSyntax());
		else
			outputChat.send(result);

	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:19,代码来源:CommandHelp.java


示例5: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws CommandException {
	try{
		if(!canBeExecuted()){
			return;
		}

		if (currentAdmins.remove(userToRemovedID))
			outputChat.send("Admin removed.");
		else
			outputChat.send("Can not find that user.");

	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}

}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:18,代码来源:CommandRemoveAdmin.java


示例6: canBeExecuted

import com.skype.SkypeException; //导入依赖的package包/类
private boolean canBeExecuted() throws NullOutputChatException, SkypeException {
	if (outputChat == null)
		throw new NullOutputChatException("Empty output chat.");

	if (isUserToBeRemovedBotOwner()) {
		outputChat.send("Can not remove bot owner.");
		return false;
	}

	if (userToRemovedID.equals("")) {
		outputChat.send(getSyntax());
		return false;
	}

	return true;
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:17,代码来源:CommandRemoveAdmin.java


示例7: canBeExecuted

import com.skype.SkypeException; //导入依赖的package包/类
private boolean canBeExecuted() throws NullOutputChatException, SkypeException {
	if (outputChat == null)
		throw new NullOutputChatException("Empty output chat.");

	if (timesToBeRepeated >= MAX_REPEATED_TIMES) {
		outputChat.send("Big number of times.");
		return false;
	}

	if (timesToBeRepeated < 0) {
		outputChat.send("Invalid number of times.");
		return false;
	}

	return true;
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:17,代码来源:CommandSpam.java


示例8: handleCommand

import com.skype.SkypeException; //导入依赖的package包/类
/**
 * This methods handles the command preprocess and execution. It does all
 * necessary checking before executing the command. Checking if commands are
 * enabled if this user can execute a command and more. (check
 * {@link #canExecuteCommand(String, ChatMessage)}
 * <p>
 * If the user is administrator he can execute the command no matter what.
 *
 * @param commandMessage
 *            the command message.
 * @throws SkypeException
 *             the skype exception
 */
public void handleCommand(ChatMessage commandMessage) throws SkypeException {
	final String senderId = commandMessage.getSenderId();
	final String[] splittedCommand = preprocessCommand(commandMessage,commandMessage.getSenderId());
	final CommandData data = createCommandData(commandMessage, splittedCommand);
	Command command = null;

	try {
		command = getCommand(splittedCommand);
	} catch (UnknownCommandException e) {
		commandMessage.getChat().send("Unknown command.");
		return;
	}

	if (!canExecuteCommand(senderId, command.getName()))
		return;

	extraHandling(splittedCommand, data);

	command.setData(data);
	CommandInvoker.execute(command);
	findSenderInformation(senderId).increaseTotalCommandsToday(); //increase commands
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:36,代码来源:CommandHandler.java


示例9: preprocessCommand

import com.skype.SkypeException; //导入依赖的package包/类
/**
 * Receives a command and the id of sender. The command format is
 * "!CommandName [list_of_parameters]". It splits the command and each one of
 * parameters to a String array and removes the exclamation mark from the
 * beginning of command. Also checks if the sender of command is the owner of the
 * bot, if yes then we delete the command from skype client.
 * 
 * @param commandMessage
 *            The message with hold the command as a big string
 * @return the commandMessage text splitted.
 * @throws SkypeException
 */
private String[] preprocessCommand(ChatMessage commandMessage,
		String senderId) throws SkypeException {

	final String[] splittedCommand = StringUtil
		.splitIgoringQuotes(commandMessage.getContent());

	//Remove ! from the beginning of command 
	splittedCommand[COMMAND_NAME_POS] =
		splittedCommand[COMMAND_NAME_POS].substring(EXCLAMATION_POSITION).toLowerCase();

	//TODO: Give user a config option for that.
	if (isSenderBotsOwner(senderId))
		commandMessage.setContent("");

	return splittedCommand;

}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:30,代码来源:CommandHandler.java


示例10: handleNormalChat

import com.skype.SkypeException; //导入依赖的package包/类
public void handleNormalChat(ChatMessage message, Long timeSend) throws SkypeException {
	UserInformation userInfo = users.get((message.getSender().getId()));
	userInfo.increaseTotalMessagesToday();

	if (userInfo.getLastMessage() == null) {
		userInfo.setLastMessage(message, timeSend);
		return;
	}
		
	if (Config.EnableWarnings) {
		if (!canHandleWarning(message))
			return;

		if (timeSend - userInfo.getLastMessageTime() < Config.WarningInterval) {
			userInfo.increaseWarning();
		}

		if (userInfo.getWarnings() >= Config.WarningNumber) {
			userInfo.ResetWarnings();
			takeWarningAction(message);
		}

		userInfo.setLastMessage(message, timeSend);
	}

}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:27,代码来源:NormalChatHandler.java


示例11: takeWarningAction

import com.skype.SkypeException; //导入依赖的package包/类
private void takeWarningAction(ChatMessage message) {
	try {
		Chat outputChat = message.getChat();
		String senderID = message.getSender().getId();

		if (WARNING_ACTION == Config.WARNING_ACTION_SET_LISTENER)
			outputChat.send("/setrole " + senderID + " LISTENER");
		else if (WARNING_ACTION == Config.WARNING_ACTION_KICK)
			outputChat.send("/kick " + senderID);
		else if (WARNING_ACTION == Config.WARNING_ACTION_KICKBAN)
			outputChat.send("/kickban " + senderID);

	} catch (SkypeException e) {
		//sending command with api throws exception. Ignore them.
	}

}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:18,代码来源:NormalChatHandler.java


示例12: chatMessageSent

import com.skype.SkypeException; //导入依赖的package包/类
/**
 * This is the main method of this class. For every message user sends it checks
 * if it is "!addlister" and if it then it clears the message from skype and adds
 * one {@link GroupChatListener listener} for this specific chat.
 * 
 * <p>
 * Also this method checks if user has activated edit lister. If he has then it
 * also registers and one {@link GroupChatEditListener editListener} for the
 * specific chat.
 * 
 * @see com.skype.ChatMessageListener#chatMessageSent(com.skype.ChatMessage)
 * 
 */
@Override
public void chatMessageSent(ChatMessage sent) throws SkypeException {
	if (!sent.getContent().equalsIgnoreCase("!addlistener"))
		return;

	Chat chat = sent.getChat();
	if (!registeredChats.contains(chat)) {
		sent.setContent("");

		GroupChatListener group = new GroupChatListener(chat);
		Skype.addChatMessageListener(group);

		//System.out.println(chat.getWindowTitle());

		if (Config.EnableEdits)
			Skype.addChatMessageEditListener(group.getEditListener());

		registeredChats.add(chat);
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:34,代码来源:GroupChatAdderListener.java


示例13: handle

import com.skype.SkypeException; //导入依赖的package包/类
private void handle(ChatMessage message) throws Exception {
    if (!CHATBOT_TROLL) {
        try {
            String[] args = message.getContent().split(" ");
            if (commands.containsKey(args[0])) {
                String response = commands.get(args[0]).command(message, Arrays.copyOfRange(args, 1, args.length));
                if (response == null) return;
                Keyboard.type(response);
                if (DEBUG) System.out.println(response);
            }
        } catch (SkypeException e) {
            System.out.println("invalid message " + message);
            e.printStackTrace();
        }
    } else {
        ChatterBotSession bot;
        if (!cleverBots.containsKey(message.getSenderId()))
            cleverBots.put(message.getSenderId(), botFactory.create(ChatterBotType.CLEVERBOT).createSession());
        bot = cleverBots.get(message.getSenderId());
        Keyboard.type(bot.think(
                message.
                        getContent()));
    }
}
 
开发者ID:rowtn,项目名称:SkypeNet,代码行数:25,代码来源:SkypeNet.java


示例14: printToChat

import com.skype.SkypeException; //导入依赖的package包/类
private void printToChat(String text) {
	try {
		outputChat.send(text);
	} catch (SkypeException e) {
		new WarningPopup(e.getLocalizedMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:8,代码来源:CommadVoteChoosePoll.java


示例15: printToChat

import com.skype.SkypeException; //导入依赖的package包/类
private void printToChat(String message) {
	try {
		outputChat.send(message);
	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:8,代码来源:CommandChoosePoll.java


示例16: printInfo

import com.skype.SkypeException; //导入依赖的package包/类
private String printInfo() throws SkypeException {
	//@formatter:off
	return "Skype id: " + user.getId() + "\r\n" + 
			"Displayed name: " + user.getFullName() + "\r\n" + 
			"Status: " + user.getStatus() + "\r\n" + 
			"Last time online: " + user.getLastOnlineTime().toString() + "\r\n" + 
			"Total messages today: " + userInfo.getTotalMessagesToday() + "\r\n" + 
			"Current amount of warnings: " + userInfo.getWarnings(); 
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:10,代码来源:CommandInfo.java


示例17: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws CommandException {
	if (outputChat == null)
		throw new NullOutputChatException();
	
	try {
		for (String admin : currentAdmins) {
			outputChat.send(admin + "\r\n");
		}
	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}

}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:15,代码来源:CommandShowAdmins.java


示例18: printToChat

import com.skype.SkypeException; //导入依赖的package包/类
private void printToChat(Chat chat, String message) {
	try {
		chat.send(message);
	} catch (SkypeException e) {
		new WarningPopup(e.getLocalizedMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:8,代码来源:CommandYoutubeSearchCommand.java


示例19: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws CommandException {
	if (outputChat == null)
		throw new NullOutputChatException("Empty output chat.");

	try {
		for (String command : commandsName) {
			outputChat.send(command);
		}
	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:14,代码来源:CommandGetAllCommands.java


示例20: execute

import com.skype.SkypeException; //导入依赖的package包/类
@Override
public void execute() throws NullOutputChatException {
	try {

		if (!canBeExecuted())
			return;

		for (int i = 0; i < timesToBeRepeated; i++)
			outputChat.send(text);

	} catch (SkypeException e) {
		new WarningPopup(e.getMessage());
	}
}
 
开发者ID:Cuniq,项目名称:SkypeBot,代码行数:15,代码来源:CommandSpam.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SetAclResponseProto类代码示例发布时间:2022-05-23
下一篇:
Java ContactPoint类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap