/** * Constructor to set a new file * * @param mediaFile File to send * @param fileName Name of the file */ public InputFile(File mediaFile, String fileName) { this(); setMedia(mediaFile, fileName); }
/** * Use this method to set the audio to an audio existing in Telegram system * * @param audio File_id of the audio to send * @note The file_id must have already been received or sent by your bot */ public SendAudio setAudio(String audio) { this.audio = new InputFile(audio); return this; }
public String getFileUrl(String botToken) { return getFileUrl(botToken, filePath); }
/** * @param msg the message to be replied to * @return a predicate that asserts that the update is a reply to the specified message. */ public static Predicate<Update> isReplyTo(String msg) { return update -> update.getMessage().getReplyToMessage().getText().equals(msg); }
private Optional<Message> send(String message, Update upd) { Long chatId = upd.getMessage().getChatId(); return silent.send(getLocalizedMessage(message, AbilityUtils.getUser(upd).getLanguageCode()), chatId); }
public Long getChatId() { return chat.getId(); }
public boolean isGroupMessage() { return chat.isGroupChat(); }
public boolean isUserMessage() { return chat.isUserChat(); }
/** * Use this method to set the document to an document existing in Telegram system * * @param document File_id of the document to send * @note The file_id must have already been received or sent by your bot */ public SendDocument setDocument(String document) { this.document = new InputFile(document); return this; }
/** * Constructor to set a new file as stream * * @param mediaStream File to send * @param fileName Name of the file */ public InputFile(InputStream mediaStream, String fileName) { this(); setMedia(mediaStream, fileName); }
public SendSticker setSticker(String sticker) { this.sticker = new InputFile(sticker); return this; }
public InputFile(String attachName) { this(); setMedia(attachName); }
public AddStickerToSet setPngSticker(String pngSticker) { this.pngSticker = new InputFile(pngSticker); return this; }
public SendVideo setVideo(String video) { this.video = new InputFile(video); return this; }
public UploadStickerFile setPngSticker(String pngStickerName, InputStream pngStickerStream) { this.pngSticker = new InputFile(pngStickerStream, pngStickerName); return this; }
public SendVideoNote setVideoNote(String videoNote) { this.videoNote = new InputFile(videoNote); return this; }
public SendAnimation setAnimation(String animation) { this.animation = new InputFile(animation); return this; }
public SendPhoto setPhoto(String photo) { this.photo = new InputFile(photo); return this; }
public CreateNewStickerSet setPngSticker(String pngSticker) { this.pngSticker = new InputFile(pngSticker); return this; }