A Discord bot, made with Gleam, designed to help manage a pixel art server.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Handle some events, check for errors

+19
+19
src/pablo_pixarto.gleam
··· 49 49 let state = AppState(client, last_updated, uris, channel_id) 50 50 let gateway_start_result = 51 51 gateway.new(identify, state) 52 + |> gateway.on_event(handle_event) 52 53 |> gateway.start() 53 54 54 55 case gateway_start_result { ··· 68 69 } 69 70 70 71 Nil 72 + } 73 + 74 + fn handle_event( 75 + state: AppState, 76 + event: gateway.Event, 77 + _connection: gateway.Connection(AppState), 78 + ) { 79 + case event { 80 + gateway.ErrorEvent(error) -> { 81 + logging.log(logging.Error, "[discord] " <> string.inspect(error)) 82 + gateway.continue(state) 83 + } 84 + gateway.ReadyEvent(_) -> { 85 + logging.log(logging.Info, "Bot is ready!") 86 + gateway.continue(state) 87 + } 88 + _ -> gateway.continue(state) 89 + } 71 90 } 72 91 73 92 fn schedule_check(state: AppState) -> Nil {