Coder Social home page Coder Social logo

github30 / dallify-discord-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openai/dallify-discord-bot

0.0 0.0 0.0 42 KB

Example code for using OpenAI’s NodeJS SDK with discord.js SDK to create a Discord Bot that uses Slash Commands.

License: MIT License

TypeScript 100.00%

dallify-discord-bot's Introduction

Example code for running a Discord Bot that uses OpenAI's DALL-E api to generate AI images.

This bot uses OpenAI's NodeJS SDK, and v14 of discord.js, and is written in Typescript.

This repo is not accepting Pull Requests. Please fork this repo if you want to add or change features.

Features include:

  • draw command to generate images (1 to 9) using the generations endpoint
  • save button to send images to user's DMs
  • reroll button to rerun that generation
  • expand button to zoom out of the image by using the edits (inpaint) endpoint

Discord Bot setup:

https://discordjs.guide/preparations/setting-up-a-bot-application.html

Your bot needs the following bot permissions:

  • Send Messages
  • Use Slash Commands
  • Attach Files

Use the invite link in src/Bot.ts, which includes the above permissions.

Secrets setup:

  1. Go to src/utils/constants.ts and follow the comments to create src/utils/config.json
  2. Copy your bot's client id and token into config.json
  3. Copy your server's id into config.json (https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-)
  4. Copy your OpenAI API key into config.json (https://beta.openai.com/account/api-keys)

Node server setup:

  1. install brew if you don't have it (https://docs.brew.sh/Installation)
  2. brew install npm if you don't have it
  3. npm install in repo root
  4. npm run start in repo root

Screen Shot 2022-11-04 at 8 35 39 PM

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.