GithubHelp home page GithubHelp logo

swayamshu / discord-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cops-iitbhu/discord-bot

0.0 0.0 0.0 59 KB

A Discord Bot built upon slash commands provided by Discord Beta. It works on the principle of webhooks by awaiting commands and can be deployed on serverless architecture like Vercel.

Home Page: discord-bot-three.vercel.app

JavaScript 49.13% TypeScript 50.87%

discord-bot's Introduction

COPS Discord Bot

Create an application on Discord Developer Portal

  • Go to https://discord.com/developers/applications (login using your discord account if required).
  • Click on New Application button available at left side of your profile picture. Name your application and click on Create.
  • Go to Bot section, click on Add Bot, and finally on Yes, do it! to confirm.

That's it. A new application is created which will hold our Slash Command. Don't close the tab as we need information from this application page throughout our development.

Creating Command

Before we can write some code, we need to make a post request to register a Slash Command in our app.

Fill BOT_TOKEN with the token available in the Bot section and APPLICATION_ID with the ID available on the General Information section of the page

Make a POST request to "https://discord.com/api/v10/applications/<APPLICATION_ID>/commands" using your preferred GUI or CLI containing

  • body:
    {
      name:"name",
      description:"description"
    }
  • headers:
    {
        "Authorization": "Bot <BOT_TOKEN>"
    }
    

NOTE: currently bot supports only devtalks

Authorizing Your Application

Application commands do not depend on a bot user in the guild; they use the interactions model. To create commands in a guild, your app must be authorized with the applications.commands scope.

In order to make commands work within a guild, the guild must authorize your application with the applications.commands scope. The bot scope is not enough.

Deployment

publickey is available on the General Information section of the page

  • vercel login
  • Add environment variable publickey in your vercel project for prod
  • Deployment vercel --prod

discord-bot's People

Contributors

king-11 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.