Ehm uchun dastur (Ma’lumotlar bazasi) nomi



Download 66 Kb.
bet1/3
Sana16.11.2022
Hajmi66 Kb.
#867089
  1   2   3
Bog'liq
8802823fbc330e0febe94b947c5c2bdfee06


EHM uchun dastur (Ma’lumotlar bazasi) nomi:
O‘zbek tilida
Iqtisodiyotni o‘rgatuvchi intellektual bot
Rus tilida
Интеллектуальный бот, обучающий экономике

Huquq ega(lar)si :



  1. Rajabov Sherzod Baxtiyorovich

  2. Mannanova Shaxida Gaybullayevna

  3. Abdullayeva Iroda Maxmudjanovna

Muallif(lar):



  1. Rajabov Sherzod Baxtiyorovich

  2. Mannanova Shaxida Gaybullayevna

  3. Abdullayeva Iroda Maxmudjanovna


EHM uchun dasturni identifikatsiya qiluvchi materiallar dastlabki matni (Dastur kodi)
package service;

import model.Word;


import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.api.methods.send.SendAudio;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.methods.updatingmessages.DeleteMessage;
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageReplyMarkup;
import org.telegram.telegrambots.meta.api.methods.updatingmessages.EditMessageText;
import org.telegram.telegrambots.meta.api.objects.*;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons.InlineKeyboardButton;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;

import javax.jws.soap.SOAPBinding;


import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;

import static java.lang.Math.toIntExact;

public class Telegram extends TelegramLongPollingBot {

public Database db = Database.getDB();


public Map userState = new HashMap<>();

@Override


public void onUpdateReceived(Update update) {

if (update.hasCallbackQuery()) {

CallbackQuery callbackQuery = update.getCallbackQuery();
String data = callbackQuery.getData();

if (userState.get(callbackQuery.getMessage().getChatId()).equals("langFrom")) {


db.from = data;
userState.put(callbackQuery.getMessage().getChatId(), "langTo");

String call_data = update.getCallbackQuery().getData();


String message_id = update.getCallbackQuery().getMessage().getMessageId().toString();
String chat_id = update.getCallbackQuery().getMessage().getChatId().toString();
String inline_message_id = update.getCallbackQuery().getInlineMessageId();

EditMessageText new_message = new EditMessageText();


new_message.setMessageId(toIntExact(Long.parseLong(message_id)));
new_message.setChatId(chat_id);
new_message.setText("Choose To lang");

InlineKeyboardMarkup markup = db.getInlineKeyboard(Arrays.asList(new String[]{


"\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67\uDB40\uDC7F English",
"\uD83C\uDDF9\uD83C\uDDF7 türk",
"\uD83C\uDDF7\uD83C\uDDFA Русский"}),
Arrays.asList(new String[]{"enTo", "trTo", "ruTo"}));

new_message.setReplyMarkup(markup);

try {
execute(new_message);
} catch (TelegramApiException e) {
e.printStackTrace();
}

}

if (data.substring(2).equals("To")) {


db.to = data.substring(0, 2);
userState.put(callbackQuery.getMessage().getChatId(), "ask");
askWord(callbackQuery.getMessage());
}

}

String text = update.getMessage().getText();


Long chatId = update.getMessage().getChatId();

switch (text) {

case "/start":
userState.put(chatId, "start");
start(update.getMessage());
break;
case "\uD83D\uDD01 Choose language":
userState.put(chatId, "langFrom");
translator(update.getMessage());
break;
case "\uD83D\uDCC3 About program":
info(update.getMessage());
break;
}

if (userState.containsKey(chatId)) {


if (userState.get(chatId).equals("ask")) {
translateWord(text, update.getMessage());
}
}

if (userState.get(chatId).equals("ask")){


askWord(update.getMessage());
}

}

private void info(Message message) {


SendMessage sendMessage = new SendMessage();
sendMessage.setText("Welcome to


Download 66 Kb.

Do'stlaringiz bilan baham:
  1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish