This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directive, ElementRef, Input, OnChanges, Renderer2, SimpleChanges } from '@angular/core'; | |
| import { from, of } from 'rxjs'; | |
| import { concatMap, delay } from 'rxjs/operators'; | |
| @Directive({ | |
| selector: '[appTypingAnimation]', | |
| standalone: true, | |
| }) | |
| export class TypingAnimationDirective implements OnChanges { | |
| @Input() appTypingAnimation: string = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h1>Hello, world</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.example; | |
| import net.thauvin.erik.crypto.CryptoPrice; | |
| import org.telegram.telegrambots.bots.TelegramLongPollingBot; | |
| import org.telegram.telegrambots.meta.api.methods.send.SendMessage; | |
| import org.telegram.telegrambots.meta.api.methods.send.SendPhoto; | |
| import org.telegram.telegrambots.meta.api.objects.InputFile; | |
| import org.telegram.telegrambots.meta.api.objects.Update; | |
| import org.telegram.telegrambots.meta.exceptions.TelegramApiException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void sendPic(long chatId, String namePic) throws Exception { | |
| var pic = getClass().getClassLoader().getResource(namePic); | |
| var message = new SendPhoto(); | |
| message.setChatId(chatId); | |
| message.setPhoto(new InputFile(pic.openStream(), namePic)); | |
| execute(message); | |
| } | |
| void sendAllPics(long chatId) throws Exception { | |
| sendPic(chatId, "b.png"); | |
| sendPic(chatId, "e.png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| else if (text.matches("^\\d+$")) { | |
| int number = Integer.parseInt(text); | |
| var priceBTC = CryptoPrice.spotPrice("BTC"); | |
| var priceETH = CryptoPrice.spotPrice("ETH"); | |
| var priceDOGE = CryptoPrice.spotPrice("DOGE"); | |
| double btcPrice = priceBTC.getAmount().doubleValue(); | |
| double ethPrice = priceETH.getAmount().doubleValue(); | |
| double dogePrice = priceDOGE.getAmount().doubleValue(); | |
| message.setText("BTC quantity: " + number / btcPrice + " ETH quantity: " + number / ethPrice + " DOGE quantity" + number / dogePrice); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| else if (text.equals("/all")) { | |
| var priceBTC = CryptoPrice.spotPrice("BTC"); | |
| var priceETH = CryptoPrice.spotPrice("ETH"); | |
| var priceDOGE = CryptoPrice.spotPrice("DOGE"); | |
| message.setText("BTC price: " + priceBTC.getAmount().doubleValue() + " ETH price: " + priceETH.getAmount().doubleValue() + " DOGE price: " + priceDOGE.getAmount().doubleValue()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| else if (text.equals("doge")) { | |
| var price = CryptoPrice.spotPrice("DOGE"); | |
| message.setText("Dogecoin price: " + price.getAmount().doubleValue()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class Main { | |
| public static void main(String[] args) { | |
| var scaner = new Scanner(System.in); | |
| System.out.println("What is the weight (kg)?"); | |
| var weight = scaner.nextDouble(); | |
| System.out.println("UAH per kg?"); |