Giter Site home page Giter Site logo

disccord's People

Contributors

abuneri avatar edosedgar avatar finitereality avatar unleashy avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

disccord's Issues

route building issue with single major param and multiple minor params

I realized this test case wasn't being covered in the unit tests atm. Here is some information in why I think there may be an issue. Let me know if you want more info/tests to be sure.

  • Tests 1 and 2 don't construct the full_url correctly, and will break when calling the api method.
  • Tests 3 and onwards correctly construct the full_url, but it seems the major parameter in bucket_url actually takes the value. this won't break any endpoints, since we only use full_url, but will still break unit tests.

For routes like test 1 and 2, as a quick "fix", I am just turning them into a single major/minor param for now. (i believe it only affects these 2 exact routes in question)

1. Tested this scenario:

auto myRoute = get_route("PUT", "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me",
        "1234567890", "0987654321", "%E2%AD%90");

Error

 REQUIRE( myRoute.full_url == "/channels/1234567890/messages/0987654321/reactions/%E2%AD%90/@me" )
with expansion:
  "/channels/1234567890/messages/0987654321/reactions/%E2%AD%90"
  ==
  "/channels/1234567890/messages/0987654321/reactions/%E2%AD%90/@me"

2. Tested this scenario:

auto myRoute = get_route("DELETE", "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}",
        "1234567890", "0987654321", "%E2%AD%90", "4321098765");

Error

due to unexpected exception with message:
  basic_string::replace: __pos (which is 18446744073709551615) > this->size()
  (which is 60)

3. Tested this scenario:

get_route("GET", "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}",
        "1234567890", "0987654321", "%E2%AD%90");

Error

 REQUIRE( myRoute.bucket_url == "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}" )
with expansion:
  "/channels/1234567890/messages/{message.id}/reactions/{emoji}"
  ==
  "/channels/{channel.id}/messages/{message.id}/reactions/{emoji}"

4. Tested this scenario:

auto myRoute = get_route("DELETE", "/channels/{channel.id}/messages/{message.id}/reactions", 
        "1234567890", "0987654321");

Error

 REQUIRE( myRoute.bucket_url == "/channels/{channel.id}/messages/{message.id}/reactions" )
with expansion:
  "/channels/1234567890/messages/{message.id}/reactions"
  ==
  "/channels/{channel.id}/messages/{message.id}/reactions"

5. Tested this scenario:

auto myRoute = get_route("GET", "/guilds/{guild.id}/members?before={user}&limit={limit}", 
        "1234567890", "0987654321", "100");

Error

 REQUIRE( myRoute.bucket_url == "/guilds/{guild.id}/members?before={user}&limit={limit}" )
with expansion:
  "/guilds/1234567890/members?before={user}&limit={limit}"
  ==
  "/guilds/{guild.id}/members?before={user}&limit={limit}"

REST API

This issue will be used to track the status of the REST API.

  • GET /gateway

Documentation

What tools should we use for generating documentation? What should the docs contain?

Wrap code to 80 columns

All future code should be wrapped to 80 columns (including line terminators: we use line-feeds, so that means 79 columns available for code).

This is to make the code easier to read on a single screen without having to scroll horizontally.

Wrap all Discord models

This is super duper tedious. I gave up after writing three.

List shamelessly stolen from Discord.Net

  • Application
  • Attachment
  • Ban
  • Channel
  • Connection
  • Embed
  • Embed Author
  • Embed Field
  • Embed Footer
  • Embed Image
  • Embed Provider
  • Embed Thumbnail
  • Embed Video
  • Emoji
  • Game
  • Guild
  • Guild Embed
  • Guild Member
  • Integration
  • Integration Account
  • Invite
  • Invite Channel
  • Invite Guild
  • Invite Metadata
  • Message
  • Overwrite
  • Presence
  • Reaction
  • Read State
  • Relationship
  • Role
  • User
  • User Guild
  • Voice Region
  • Voice State

Unit tests

Unit tests are needed to ensure the code I'm writing actually works. This involves adding some stuff to the CMakeLists to allow building of unit tests.

  • Add unit test support to CMakeLists
  • Use Travis CI to build disccord
  • Use Travis CI to run tests
  • Write preliminary unit tests

Support Audit Logs

The endpoint(s) are open now, probably will be released (on canary) very soon:tm:, so may as well prepare to support this so it's not forgotten later.
NOTE: will update the issue's task list if more things end up being needed

1. disccord::models

  • Build audit_logs model
  • model structure:
  • new classes needed for structure
    • std::vector<audit_log_entry>
    • audit_log_entry has a member std::vector<audit_log_change>
{
"users": ["<user models>"],
"audit_log_entries": [{
  "target_id": "<?snowflake>",
  "user_id": "<snowflake>",
  "id": "<snowflake>",
  "action_type": "<int enum>",
  "changes": [{
    "?old_value":"<snowflake>/<string>/<bool>/<int>",
    "new_value":"<snowflake>/<string>/<bool>/<int>",
    "key":"<key_types>"
    }]
  }]
}
  • key_types:
{
    NAME: "name",
    ICON_HASH: "icon_hash",
    SPLASH_HASH: "splash_hash",
    OWNER_ID: "owner_id",
    REGION: "region",
    AFK_CHANNEL_ID: "afk_channel_id",
    AFK_TIMEOUT: "afk_timeout",
    MFA_LEVEL: "mfa_level",
    WIDGET_ENABLED: "widget_enabled",
    WIDGET_CHANNEL_ID: "widget_channel_id",
    VERIFICATION_LEVEL: "verification_level",
    EXPLICIT_CONTENT_FILTER: "explicit_content_filter",
    DEFAULT_MESSAGE_NOTIFICATIONS: "default_message_notifications",
    VANITY_URL_CODE: "vanity_url_code",
    POSITION: "position",
    TOPIC: "topic",
    TYPE: "type",
    BITRATE: "bitrate",
    PERMISSION_OVERRIDES: "permission_overrides",
    ROLES_ADD: "$add",
    ROLES_REMOVE: "$remove",
    NICK: "nick",
    DEAF: "deaf",
    MUTE: "mute",
    PERMISSIONS: "permissions",
    COLOR: "color",
    HOIST: "hoist",
    MENTIONABLE: "mentionable",
    CODE: "code",
    CHANNEL_ID: "channel_id",
    INVITER_ID: "inviter_id",
    MAX_USES: "max_uses",
    USES: "uses",
    MAX_AGE: "max_age",
    TEMPORARY: "temporary",
    APPLICATION_ID: "application_id",
    AVATAR_HASH: "avatar_hash",
    ID: "id",
    PERMISSIONS_GRANTED: "allow",
    PERMISSIONS_DENIED: "deny",
    REASON: "reason"
}
  • action_type enums:
{
    ALL: null, (in our case, we will have ALL map to 0)
    GUILD_UPDATE: 1,
    CHANNEL_CREATE: 10,
    CHANNEL_UPDATE: 11,
    CHANNEL_DELETE: 12,
    CHANNEL_OVERWRITE_CREATE: 13,
    CHANNEL_OVERWRITE_UPDATE: 14,
    CHANNEL_OVERWRITE_DELETE: 15,
    MEMBER_KICK: 20,
    MEMBER_PRUNE: 21,
    MEMBER_BAN_ADD: 22,
    MEMBER_BAN_REMOVE: 23,
    MEMBER_UPDATE: 24,
    MEMBER_ROLE_UPDATE: 25,
    ROLE_CREATE: 30,
    ROLE_UPDATE: 31,
    ROLE_DELETE: 32,
    INVITE_CREATE: 40,
    INVITE_UPDATE: 41,
    INVITE_DELETE: 42,
    WEBHOOK_CREATE: 50,
    WEBHOOK_UPDATE: 51,
    WEBHOOK_DELETE: 52,
    EMOJI_CREATE: 60,
    EMOJI_UPDATE: 61,
    EMOJI_DELETE: 62
}
  • for the action_types, will build an enum class audit_logs_action_type.

2. disccord::rest

  • GET /guilds/{guild.id}/audit-logs
  • query string params:
limit: <int> (default is 50, can be 1-100)
query: <string> "before"/"after"
id : <snowflake>
action_type: <integer>

Missing const-correctness

Some areas are missing const where the values returned/used/etc are not modified and so should be const.

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.