SwiftDiscord
SwiftDiscord copied to clipboard
vapor + swift discord = offline
xcode + vapor 3.08 +swiftdiscord vapor branch creating controller
class SwiftDiscordController: DiscordClientDelegate {
var client: DiscordClient!
func botstart(){
client = DiscordClient(token: "Bot sometoken", delegate: self, configuration: [.log(.info)])
client.connect()
}
func client(_ client: DiscordClient, didConnect connected: Bool) {
print("Bot connected!")
}
func client(_ client: DiscordClient, didCreateMessage message: DiscordMessage) {
if message.content == "$mycommand" {
message.channel?.send("I got your command")
}
}
}
in boot.swift boot func
let sdc = SwiftDiscordController()
sdc.botstart()`
the output is `Run[5716:7036429] LOG: DiscordWebSocketable: Connecting to wss://gateway.discord.gg/?v=6, shard: 0
2018-09-04 22:22:25.770318+0300 Run[5716:7036429] LOG: DiscordWebSocketable: Attaching WebSocket, shard: shard: 0
and some time later
2018-09-04 22:25:25.738707+0300 Run[5716:7047070] [BoringSSL] Function boringssl_session_errorlog: line 2881 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert 2018-09-04 22:25:25.739887+0300 Run[5716:7047070] [BoringSSL] Function boringssl_session_errorlog: line 2881 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert 2018-09-04 22:25:25.740186+0300 Run[5716:7047070] TIC Read Status [1:0x102732400]: 1:57 2018-09-04 22:25:25.740348+0300 Run[5716:7047070] TIC Read Status [1:0x102732400]: 1:57 2018-09-04 22:25:25.740428+0300 Run[5716:7047070] TIC Read Status [1:0x102732400]: 1:57
but i think that's xcode bug
bot is offline, can't figure out what is the cause the whole day
p.s. sorry if it is smth simple, the head just blowing what can it be p.p.s token used as is, with bot/bearer; looks like it is auto changing with some time also in discordoauth.swift baseURL = "https://discordapp.com/api/oauth2/ blank or token ending?
@Chidorin Do you get any logs about connecting or anything? The vapor3 branch is very much WIP, and I've paused dev on it for the time being until Vapor's WebSocket implementation stops being shit, or I find a better alternative.
the only response i get i wrote above or is there any other more informative place? edit: i mean the place where else to look for logs
@Chidorin Are you calling dispatchMain or any other method to start a run loop? If you're this as a command line app, you have to manually start the main loop.