bondiano / telega-gleam

Gleam library to build Telegram bots
Apache License 2.0
22 stars 4 forks source link

the examples can't built after a dependancy change #19

Closed sanabel-al-firdaws closed 1 week ago

sanabel-al-firdaws commented 2 weeks ago

it shows me 3 errors related to the glisten package

error: Unknown module value
   ┌─ C:\gleam_project\build\packages\glisten\src\glisten\socket\options.gleam:80:22
   │
80 │   |> list.map(dynamic.unsafe_coerce)
   │                      ^^^^^^^^^^^^^^

The module gleam/dynamic does not have a unsafe_coerce value.

in gleam's std v0.40.0 - 2024-08-19 The deprecated dynamic.unsafe_coerce function has been removed.

using windows

sanabel-al-firdaws commented 1 week ago

changing the library toml file to this seems to fix it

name = "telega"
version = "0.3.0"
description = "Gleam Telegram Bot Library"
licences = ["Apache-2.0"]
repository = { type = "github", user = "bondiano", repo = "telega" }
links = [
    { title = "Issues", href = "https://github.com/bondiano/telega/issues" },
    { title = "Examples", href = "https://github.com/bondiano/telega/tree/master/examples" },
]

# gleam = ">= 0.32.0"
target = "erlang"
dependencies = { gleam_stdlib = ">= 0.40.0 and < 1.0.0", logging = ">= 1.3.0 and < 2.0.0", gleam_http = ">= 3.7.0 and < 4.0.0", gleam_httpc = ">= 3.0.0 and < 4.0.0", wisp = ">= 1.2.0 and < 2.0.0", gleam_json = ">= 2.0.0 and < 3.0.0", gleam_erlang = ">= 0.27.0 and < 1.0.0", gleam_otp = ">= 0.12.1 and < 1.0.0", glisten = ">= 6.0.0 and < 7.0.0" }

[dev-dependencies]
gleeunit = "~> 1.0"
mockth = "0.3.2"
sanabel-al-firdaws commented 1 week ago

also made a small change here

  let secret_key_base = wisp.random_string(64)
  let assert Ok(_) =
    wisp_mist.handler(handle_request(bot, _), secret_key_base)
    |> mist.new
    |> mist.port(8000)
    |> mist.start_http
    |> result.nil_error

  process.sleep_forever()
}