Загрузка данных


# начало

Host = "ссылка на хостинг"
DB_path = /db
CALLS_path = /db/calls
users_file = /db/users.json
chats_file = db/chats.json
stories_file = db/stories.json
calls_file - db/calls.json

#создать чат

element nameInput {
  type: input
  text: "name_"
  x: 200
  y: 90
  width: 300
  height: 30
}

element usernameInput {
  type: input
  text: "username"
  x: 200
  y: 70
  width: 300
  height: 30
}

element priceInput {
  type: input
  text: "username"
  x: 200
  y: 50
  width: 300
  height: 30
}

element completeButton {
  type: button
  text: "complete"
  x: 200
  y: 20
  width: 150
  height: 40
  color: "#4CAF50"

functions(completeButton):
  on_click:
    var name_chat = getText(nameInput):
      create new block in chats_path with generate name 0000 - 9999 if name == true in chats_path, to generate 0000 - 9999:  #если название уже есть гдето такое то перегенерируем
        safewrite name_chat in chats_path #записываем переменную name_chat в новый раздел chats_path чтоб там не было путаницы
    var username_chat = getText(usernameInput):
      create new block in chats_path with generate name 0000 - 9999 if name == true in chats_path, to generate 0000 - 9999:
        safewrite username_chat in chats_path #записываем переменную username_chat в новый раздел chats_path чтоб там не было путаницы
    var price_chat = getText(priceInput):
      create new block in chats_path with generate name 0000 - 9999 if name == true in chats_path, to generate 0000 - 9999:
        safewrite price_chat in chssats_path #записываем переменную price_chat в новый раздел chats_path чтоб там не было путаницы
    var chat_id = generate chat_id 00000000 - 99999999
    var owner_chat = generate owner_chat 00000000 - 99999999
    end
  end
end

functions(create chat):
  generate chat_id 00000000 - 99999999
	safewrite chat_id in chats_path:
		name = name_chat
		owner = owner_chat
		username = username_chat
		priceSMS = price_chat

# в функции отправки смс

if button == tap:      #нажал кнопку = отправить
	savewrite chats_file:
		id-chat: id_chat
		user: user_send
		sms: send_sms

# получение смс

getsms = get id_chat from chats_file
saferead  chats_path