GithubHelp home page GithubHelp logo

tea-ayataka / kordis Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 7.0 316 KB

A lightweight and stable Kotlin wrapper for the Discord API

License: Do What The F*ck You Want To Public License

Kotlin 100.00%
discord discord-api kotlin kotlin-coroutines kotlin-library

kordis's People

Contributors

alexczar avatar luna5ama avatar toliner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kordis's Issues

Does not handle these packets

[03:32:42] [ERROR]: Failed to handle the event! (type: GUILD_DELETE, json: {"id":"0000000000"})
java.lang.NullPointerException: data["guild_id"] must not be null
at net.ayataka.kordis.websocket.handlers.GatewayHandler$DefaultImpls.deserializeServer(GatewayHandler.kt:14) ~[Kordis-a6530c1.jar:?]
at net.ayataka.kordis.websocket.handlers.guild.GuildDeleteHandler.deserializeServer(GuildDeleteHandler.kt:10) ~[Kordis-a6530c1.jar:?]
at net.ayataka.kordis.websocket.handlers.guild.GuildDeleteHandler.handle(GuildDeleteHandler.kt:14) ~[Kordis-a6530c1.jar:?]
at net.ayataka.kordis.websocket.GatewayClient.handleEvent(GatewayClient.kt:395) [Kordis-a6530c1.jar:?]
at net.ayataka.kordis.websocket.GatewayClient.handleMessage(GatewayClient.kt:385) [Kordis-a6530c1.jar:?]
at net.ayataka.kordis.websocket.GatewayClient.onBinaryMessage(GatewayClient.kt:333) [Kordis-a6530c1.jar:?]
at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385) [nv-websocket-client-2.8.jar:?]
at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276) [nv-websocket-client-2.8.jar:?]
at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996) [nv-websocket-client-2.8.jar:?]
at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755) [nv-websocket-client-2.8.jar:?]
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108) [nv-websocket-client-2.8.jar:?]
at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64) [nv-websocket-client-2.8.jar:?]
at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45) [nv-websocket-client-2.8.jar:?]

How to edit channel permissions?

I apologize if I've glossed over something, but I can't find tests for editing channels, nor examples.

Adding tests for creating, editing channel permissions and then deleting said channel would be nice.

Tests are not contribution-friendly

Looks like currently the tests are tied to a specific discord server.
So it is quite hard to contribute.
What about rewriting tests to use WireMock or something similar, to not depend on the live discord?
I'd be happy to rewrite currently existing test and contribute.

Reaction adding / removing support

I made my own impl with the API like so, you're free to use it / implement it however you're doing API requests

/**
 * [emoji] is the single unicode Char you want to react with
 * [encode] is if you want to URI encode your [emoji]
 */
fun Message.addReaction(emoji: Char, encode: Boolean = true) {
    val encodedEmoji = URLEncoder.encode(emoji.toString(), "utf-8")
    val url = "https://discord.com/api/v6/channels/${this.channel.id}/messages/${this.id}/reactions/${if (encode) encodedEmoji else emoji.toString()}/@me"
    val body = RequestBody.create(MediaType.parse(""), "")

    val request = Request.Builder()
        .addHeader("Content-Length", "0")
        .addHeader("Authorization", "Bot ${getAuthToken()}")
        .url(url).put(body).build()

    OkHttpClient().newCall(request).execute()
}

It would be nice to properly support this however

Edit: getting a list of reactions for a message would also be nice to have, so you can remove them based on name and the such

Option to download entire member list / check if you have intents

Hi, this commit (8d4d96f) removes the ability to get the entire member list. I understand this is a Privileged Intent, but your bot only requires verification for such permissions once it's inside more than 100 servers (and you also cannot apply until you have 75 servers).

I didn't realize until now as I switched from using 0.2.3 to the latest commit as I saw it had newer API support. It would be nice to readd this functionality with a check for privileged intents.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.