Coder Social home page Coder Social logo

discord-gateway-example's Introduction

This code has been archieved

Discord Gateway Example

You can connect with discord gateway and make requests to it using this code. This code contains most basic structures that you can use.

This code use latest version of discord Gateway (v9) and latest version of discord API (v9). This code can be updated anytime. Video tutorial of this code will be added soon

Setup for code

  1. Clone this repository.
git clone https://github.com/PasinduDushan/Discord-Gateway-Example
  1. Add your bot TOKEN inside the .env file.
  2. Open up your terminal, Go to file directory and type npm i.
  3. Type npm start in the terminal.

After you enter the npm start command, you should be connected to the discord gateway. You have to get a responce like this when you connect to the gateway.

{
  t: null,
  s: null,
  op: 10,
  d: {
    heartbeat_interval: 41250,
    _trace: [ '["gateway-prd-main-4xgr",{"micros":0.0}]' ]
  }
}

After the above responce you will get bunch of more responces like READY, GUILD_CREATE.

More details

This is the base knowledge that you should have to interact with discord Gateway and discord API. This process is the actual thing happening inside packages like discord.js under the hood. Connecting to the discord gateway is really easy but requesting is kind of complex. You can learn how to send requests to discord gateway and receive requests from it. This code contains how you can send an API request to the discord gateway, receieve it and POST it to discord chat. Also because this code written in the latest version of discord API, So you can create slash commands and buttons also.

This is basically a DISCORD BOT made without any packages like discord.js, Made just using discord gateway and discord API.

Developer Details

Discord - CoolDudeBonker#6655
Github - PasinduDushan

If you have any questions about this code or if you want support for running your own instance, I'll be really happy to help you. You can contact me via Discord at any time.

Contributing

  1. Fork & clone the repository, and make sure you're on the master branch
  2. Run npm ci
  3. Code your magic
  4. Run npm test to run ESLint and ensure any JSDoc changes are valid
  5. Submit a pull request

discord-gateway-example's People

Contributors

pasindudushan avatar

Stargazers

Minseo Lee avatar  avatar SeongJun avatar kingerious avatar  avatar Rafael Bianchi avatar MSB avatar Peter Frier avatar Proladon avatar  avatar Komo avatar Amukh1 avatar  avatar  avatar

Watchers

 avatar

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.