Code Monkey home page Code Monkey logo

gif-bot's Introduction

GIF-Bot

Practice Project for Self-learning, a discord bot that provide gif from the query

Documentation for the Project

site: https://marianiranjan.notion.site/GIF-Discord-Bot-7f952b82e897494389704f093ed4bcba?pvs=4

GIF Discord Bot

Status: Completed Themes: Practice Coding

May 27, 2024 Prepare the Essentials

  • Initialising the Git repository.

    • May 28, 2024 from new node version use the following command instead of installing dotenv then importing it.

      # when running the .js file throw node
      node --env-file .env index.js
    • Or if it’s a simple data or small amount then use with node as shown below,

      A=123 B=456 DISCORD_TOKEN=your-token-goes-here node index.js
  • Installation and Preparations

    Bot created via developer portal and added to the server, CLIENTID, SEVERID & TOKEN were added to .env file.

May 28, 2024 Create a client instance for your Discord bot and log in to Discord

  • Slash-commands added base level need to modify
  • deploy-commands file added not finished with the code

May 29, 2024 Interaction command function update

  • Create GIPHY API

    https://developers.giphy.com/dashboard/

  • Have some struggle with the url fetching

    I tried to straightly add the url as a response thinking it will automatically get the media but, we first need to use node-fetch module to fetch the data from the url from web through http request, then change the format to json. Even after we need to specify the straight link for the media.

    Direct Image URLs vs. Embed URLs

    • Direct Image URLs (json.data[0].images.original.url):

      These URLs directly point to the image file (in this case, a GIF). When sent in a Discord message, Discord fetches the image and displays it inline as an embedded image. Example: https://media.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif

    • Embed URLs (json.data[0].embed_url):

      These URLs point to a Giphy page that contains the GIF and other metadata. Discord treats these as standard URLs and does not always auto-embed them as images. Example: https://giphy.com/embed/3oEjI6SIIHBdRxXI40

gif-bot's People

Contributors

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