Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vapor + swift discord = offline #73

Open
Chidorin opened this issue Sep 4, 2018 · 3 comments
Open

vapor + swift discord = offline #73

Chidorin opened this issue Sep 4, 2018 · 3 comments

Comments

@Chidorin
Copy link

Chidorin commented Sep 4, 2018

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?

@nuclearace
Copy link
Owner

@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.

@Chidorin
Copy link
Author

Chidorin commented Sep 5, 2018

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

@nuclearace
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants