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


Java TelegramApiException.printStackTrace方法代码示例

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


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

示例1: run

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public void run(Update update, TelegramLongPollingBot bot) {

		SendMessage sm = new SendMessage();
		sm.setChatId(update.getMessage().getChatId());
		sm.setParseMode(ParseMode.HTML);
		
		String finalMessage = new String("<b>Verificador de Qualis - CAPES</b>\n");
		finalMessage = finalMessage.concat("\nUtilize os seguintes comandos para consulta\n");
		finalMessage = finalMessage.concat("\n<b>/conferencia</b> <i>sigla_conferencia</i> OU <i>nome_conferencia</i>");
		finalMessage = finalMessage.concat("\n<b>/periodico</b> <i>issn_periodico</i> OU <i>nome_periodico</i>");
		
		sm.setText(finalMessage);
		
		try {
			bot.sendMessage(sm);
		} catch (TelegramApiException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
 
开发者ID:InsightLab,项目名称:telegram-bots,代码行数:22,代码来源:StartCommand.java

示例2: main

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public static void main(String[] args) {

    	System.out.println("started");
    	
        // Initialize Api Context
        ApiContextInitializer.init();

        // Instantiate Telegram Bots API
        TelegramBotsApi botsApi = new TelegramBotsApi();

        // Register our bot
        try {
            botsApi.registerBot(new SchoolAssistantBot());
        } catch (TelegramApiException e) {
            e.printStackTrace();
        }
        
	}
 
开发者ID:calmyourtities,项目名称:school-assistant,代码行数:19,代码来源:Main.java

示例3: main

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
/**
 * Fa partire il client.<BR>
 * Uso: <code>java TestClient nick debugLevel</code><br>
 */
public static void main(String[] args) {
	boolean ldeb;
	if (args.length < 2)
		misuse();
	String nick = args[0];
	int aDeb = Integer.parseInt(args[1]);
	if (aDeb == 1)
		ldeb = true;
	else
		ldeb = false;

	// Initialize Api Context
	ApiContextInitializer.init();

	// Instantiate Telegram Bots API
	TelegramBotsApi botsApi = new TelegramBotsApi();

	// Register our bot
	try {
		botsApi.registerBot(new TelegramIlnBot(nick, ldeb, new LogServer("iln")));
	} catch (TelegramApiException e) {
		e.printStackTrace();
	}
}
 
开发者ID:alex321v,项目名称:iln,代码行数:29,代码来源:TelegramClient.java

示例4: onUpdateReceived

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
@Override
public void onUpdateReceived(Update arg0) {
	
	SendMessage msg=null;
	if(arg0.getMessage().isCommand())
		
		msg = createMessage(JlasniCommand(arg0.getMessage().getText()), arg0.getMessage().getChatId());
	else
		msg= createMessage("Error, no es un comando", arg0.getMessage().getChatId());
		
	try {
		execute(msg);
	}catch (TelegramApiException e) {
		// TODO: handle exception
		e.printStackTrace();
	}
	
	
}
 
开发者ID:zerasul,项目名称:lasnibot,代码行数:20,代码来源:JlasniBot.java

示例5: onUpdateReceived

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public void onUpdateReceived(Update update) {
	
	if(update.hasMessage()) {
		Message message = update.getMessage();
		String[] command = message.getText().split(" ");

		if(command[0].startsWith("/") && commandHash.containsKey(command[0])) {
			commandHash.get(command[0]).run(update, this);
			logger.write(update);
		} 
		
		else {
			SendMessage sm = new SendMessage();
			sm.setChatId(update.getMessage().getChatId());

			sm.setParseMode(ParseMode.HTML);
			
			sm.setText("Comando Inválido. Digite <b>/ajuda</b> para a lista de comandos.");
			try {
				sendMessage(sm);
			} catch (TelegramApiException e) {
				e.printStackTrace();
			}
		}
		
	}
	
}
 
开发者ID:InsightLab,项目名称:telegram-bots,代码行数:29,代码来源:QualisBot.java

示例6: onUpdateReceived

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
@Override
public void onUpdateReceived(Update update) {
	// TODO Auto-generated method stub
	System.out.println("Received msg");
	if (update.hasMessage() && update.getMessage().hasText()) {
		String text = update.getMessage().getText().toLowerCase();
		SendMessage message = new SendMessage();
		message.setChatId(update.getMessage().getChatId());
		//write everything in lowercase in the contains
		if(text.equals("/license") || text.equals("/license"+this.getBotUsername())){
			message.setText("Welcome!\nThis bot is a program which is available under the MIT license at https://github.com/Bergiu/TelegramEntenBot");
		}
		else if(text.contains("ente")){
			message.setText("*QUACK!*");
		// } else if (text.contains("bla")){
		// 	message.setText("*BLUB!*");
		// } else if (text.contains("kuh")){
		// 	message.setText("*MUUHH!*");
		}
		else if(text.contains("foss")){
			message.setText("*FOOOOOOOSSSS <3!*");
		}else if (text.contains("git") || text.contains("love")){
			message.setText("*<3*");
		} else {
			return;
		}
		message.setParseMode("markdown");
		try {
			sendMessage(message); // Call method to send the message
		} catch (TelegramApiException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:Bergiu,项目名称:TelegramEntenBot,代码行数:35,代码来源:EntenBot.java

示例7: sendMessage

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
private void sendMessage(long chat_id, String text) {
    SendMessage message = new SendMessage();
    message.setChatId(chat_id);
    message.setText(text);
    try{
        sendMessage(message);
    } catch (TelegramApiException e) {
        e.printStackTrace();
    }
}
 
开发者ID:franziheck,项目名称:Paulette,代码行数:11,代码来源:Paulette.java

示例8: main

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public static void main(String[] args) {
	ClassifierBot classifierBot = new ClassifierBot();
	TelegramBotsApi botsApi = new TelegramBotsApi();
	try {
		botsApi.registerBot(classifierBot);
	} catch (TelegramApiException e) {
		e.printStackTrace();
	}
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:10,代码来源:Main.java

示例9: main

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public static void main(String[] args) {
	
	ApiContextInitializer.init();

	TelegramBotsApi botsApi = new TelegramBotsApi();

	try {
		botsApi.registerBot(new TelegramClient());
	} catch (TelegramApiException e) {
		e.printStackTrace();
	}
}
 
开发者ID:alexNeto,项目名称:smart-home-bot,代码行数:13,代码来源:Main.java

示例10: onUpdateReceived

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
@Override
public void onUpdateReceived(Update update) {
	String line = null;
	String prefix, comando, params;
	String[] response;

	// We check if the update has a message and the message has text
	if (update.hasMessage() && update.getMessage().hasText()) {
		// Set variables
		long chat_id = update.getMessage().getChatId();
		mchat = update.getMessage().getChat();
		prefix = update.getMessage().getFrom().getUserName();

		if (prefix == null) {
			prefix = update.getMessage().getFrom().getFirstName();
		}

		params = nickName + " :" + update.getMessage().getText().toLowerCase().trim();
		log.logga(prefix + " --> " + nickName + ": " + update.getMessage().getText().toLowerCase().trim());

		response = trattaPrivMsg(prefix, params);

		for (int i = 0; i < response.length; i++) {
			log.logga(nickName + " --> " + prefix + ": " + response[i]);
			SendMessage message = new SendMessage() // Create a message object object
					.setChatId(chat_id).setText(EmojiParser.parseToUnicode(response[i]));
			try {
				sendMessage(message); // Sending our message object to user
			} catch (TelegramApiException e) {
				e.printStackTrace();
			}
		}	
	}
}
 
开发者ID:alex321v,项目名称:iln,代码行数:35,代码来源:TelegramIlnBot.java

示例11: main

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public static void main(String[] args) {

        ApiContextInitializer.init();

        TelegramBotsApi botsApi = new TelegramBotsApi();

        try {
            botsApi.registerBot(new QuizBot(new QuizController()));
        } catch (TelegramApiException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:argo2445,项目名称:QBot,代码行数:13,代码来源:Main.java

示例12: main

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
public static void main(String[] args) {

		// TODO Initialize Api Context
		ApiContextInitializer.init();

		// TODO Instantiate Telegram Bots API
		TelegramBotsApi botsApi = new TelegramBotsApi();

		// TODO Register our bot
		try {
			botsApi.registerBot(new GeoLearnBot());
		} catch (TelegramApiException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:Zabamund,项目名称:geoLearnBot,代码行数:16,代码来源:Main.java

示例13: onUpdateReceived

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
/**
 * Answer message on received
 *
 * @param update - message
 */
public void onUpdateReceived(Update update) {
    try {
        responseBuilder.answer(update);
    } catch (TelegramApiException e) {
        e.printStackTrace();
    }
}
 
开发者ID:paramoshkinandrew,项目名称:ninegag-telegram-bot,代码行数:13,代码来源:Bot.java

示例14: onUpdateReceived

import org.telegram.telegrambots.exceptions.TelegramApiException; //导入方法依赖的package包/类
@Override
public void onUpdateReceived(Update update) {
	
	if(Database.hasStudent(update.getMessage().getFrom().getId()))
		try {
			sendMessage(new SendMessage().setText("I am your personal school assistant!").setChatId(update.getMessage().getChatId()));
			sendMessage(new SendMessage().setText("Say \"Help\" for a list of commands, or just say what you need!").setChatId(update.getMessage().getChatId()));
		} catch (TelegramApiException e) {
			System.err.println("Error sending welcome message:");
			e.printStackTrace();
		}
	
	if(update.hasMessage() && update.getMessage().hasText() && update.getMessage().getChat().getUserName() != null /* <-- this bot isn't useful for group chats */) {
		
		String input = update.getMessage().getText();
		if(input.startsWith("/")) {
			
			//they want to use commands
			
			
		} else {
			
			//they want the human-like assistant
			
		}
		
	}
}
 
开发者ID:calmyourtities,项目名称:school-assistant,代码行数:29,代码来源:SchoolAssistantBot.java


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