Tabnine Logo
it.rebase.rebot.api.object
Code IndexAdd Tabnine to your IDE (free)

How to use it.rebase.rebot.api.object

Best Java code snippets using it.rebase.rebot.api.object (Showing top 11 results out of 315)

origin: it.rebase/rebot-persistence-service

  @Override
  public String toString() {
    return "BotStatus{" +
        "id=" + id +
        ", isEnabled=" + isEnabled +
        ", requester=" + from.toString() +
        ", timestamp='" + timestamp + '\'' +
        '}';
  }
}
origin: it.rebase/rebot-telegram-api-objects

  @Override
  public String toString() {
    return "MessageUpdate{" +
        "updateId=" + updateId +
        ", message=" + message.toString() +
        ", additionalProperties=" + additionalProperties +
        '}';
  }
}
origin: it.rebase/rebot-packt-free-learning-plugin

public String registerNotification(MessageUpdate message) {
  String channel = null;
  if (message.getMessage().getChat().getType().equals("group") || message.getMessage().getChat().getType().equals("supergroup")) {
    channel = message.getMessage().getChat().getTitle();
  } else {
    channel = message.getMessage().getFrom().getFirstName();
  }
  return repository.register(new PacktNotification(message.getMessage().getChat().getId(), channel));
}
origin: it.rebase/rebot-welcome-message-plugin

  /**
   * When a member join, left or gets excluded from an Telegram group a msg will be sent to the target group.
   * If the member added or removed is a bot, no message is sent.
   * @param update {@link MessageUpdate}
   * @return true if the message is to inform a new member or if a member left the chat
   */
  private String chatMember(MessageUpdate update) {
    ObjectMapper mapper = new ObjectMapper();
    final Message message = new Message();
    for (Map.Entry<String, Object> entry : update.getMessage().getAdditionalProperties().entrySet()) {
      log.fine("Additional Properties: KEY + " + entry.getKey() + " - VALUE " + entry.getValue().toString());
      if (entry.getKey().equals("new_chat_member") && !update.getMessage().getFrom().isIsBot()) {
        NewChatMember member = mapper.convertValue(entry.getValue(), NewChatMember.class);
        message.setText(String.format(WELCOME_MESSAGE, member.getFirst_name(), update.getMessage().getChat().getTitle()));

      } else if (entry.getKey().equals("left_chat_participant") && !update.getMessage().getFrom().isIsBot()) {
        LeftChatMember member = mapper.convertValue(entry.getValue(), LeftChatMember.class);
        message.setText(String.format(GOODBYE_MESSAGE, member.getFirst_name()));
      }
    }
    return message.getText();
  }
}
origin: it.rebase/rebot-karma-plugin

@Override
public String process(MessageUpdate update) {
  StringBuilder response = new StringBuilder();
  try {
    if (canProcess(update.getMessage().getText()) && !update.isEdited()) {
      List<String> itens = Arrays.asList(update.getMessage().getText().replaceAll("\\r|\\n", " ").split(" "));
      HashMap<String, String> finalTargets = new HashMap<>();
      String username = update.getMessage().getFrom().getUsername() != null ? update.getMessage().getFrom().getUsername() : update.getMessage().getFrom().getFirstName().toLowerCase();
      itens.stream().distinct().forEach(item -> {
        if ((KARMA_PATTERN.matcher(item).find())) {
          finalTargets.putIfAbsent(item.substring(0, item.length() - 2).toLowerCase(), item.substring(item.length() - 2));
        }
      });
      for (Map.Entry<String, String> entry : finalTargets.entrySet()) {
        response.append(processKarma(entry.getValue(), entry.getKey(), username));
      }
    } else {
      log.fine("Message " + update.getMessage().getText() + " is a updated message, ignoring...");
    }
  } catch (final Exception e) {
    e.printStackTrace();
    log.warning(e.getMessage());
  }
  return response.toString();
}
origin: it.rebase/rebot-jboss-books-service

/**
 * Send notification messages to the Telegram group that this service is active.
 *
 * @param msg
 */
private void notify(String msg) {
  Chat chat = new Chat();
  chat.setId(Long.parseLong(chatId));
  message.setChat(chat);
  message.setText(msg);
  messageSender.processOutgoingMessage(message);
}
origin: it.rebase/rebot-telegram-api-spi

/**
 * only commands redirected to this bot will be processed
 *
 * @param messageUpdate message containing the command
 * @param botUserId     bot id, this will be used to make sure that this bot can process the given command
 * @return true - processable command
 * or
 * false - non processable command
 */
default boolean canProcessCommand(MessageUpdate messageUpdate, String botUserId) {
  return true ? messageUpdate.getMessage().getText().startsWith("/") &&
      (messageUpdate.getMessage().getText().contains("@" + botUserId) || !messageUpdate.getMessage().getText().contains("@")) &&
      extractCommand(messageUpdate.getMessage().getText(), botUserId).equals(name()) : false;
}
origin: it.rebase/rebot-telegram-api-objects

  @Override
  public String toString() {
    return "EditedMessage{" +
        "messageId=" + messageId +
        ", from=" + from.toString() +
        ", chat=" + chat.toString() +
        ", date=" + date +
        ", editDate=" + editDate +
        ", text='" + text + '\'' +
        ", entities=" + entities.toString() +
        ", additionalProperties=" + additionalProperties +
        '}';
  }
}
origin: it.rebase/rebot-packt-free-learning-plugin

public String unregisterNotification(MessageUpdate message) {
  String channel = null;
  if (message.getMessage().getChat().getType().equals("group") || message.getMessage().getChat().getType().equals("supergroup")) {
    channel = message.getMessage().getChat().getTitle();
  } else {
    channel = message.getMessage().getFrom().getFirstName();
  }
  return repository.unregister(new PacktNotification(message.getMessage().getChat().getId(), channel));
}
origin: it.rebase/rebot-packt-free-learning-plugin

private void notify(BigInteger chatId) {
  Chat chat = new Chat();
  chat.setId(chatId.longValue());
  Message message = new Message();
  message.setChat(chat);
  message.setText(this.get());
  messageSender.processOutgoingMessage(message);
}
origin: it.rebase/rebot-telegram-api-spi

  /**
   * only commands redirected to this bot will be processed
   *
   * @param messageUpdate message containing the command
   * @param botUserId     bot id, this will be used to make sure that this bot can process the given command
   * @return true - processable command
   * or
   * false - non processable command
   */
  default boolean canProcessCommand(MessageUpdate messageUpdate, String botUserId) {
    if (null == messageUpdate.getMessage().getText()) {
      return false;
    } else {
      return true ? messageUpdate.getMessage().getText().startsWith("/") &&
          (messageUpdate.getMessage().getText().contains("@" + botUserId) || !messageUpdate.getMessage().getText().contains("@")) &&
          extractCommand(messageUpdate.getMessage().getText(), botUserId).equals(name()) : false;
    }
  }
}
it.rebase.rebot.api.object

Most used classes

  • Message
  • From
  • Chat
  • MessageUpdate
  • LeftChatMember
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now