本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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
}
}
}