惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
A
About on SuperTechFans
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
O
OpenAI News
美团技术团队
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
Cyberwarzone
Cyberwarzone
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
T
Tenable Blog
S
Security Affairs
博客园_首页
S
Schneier on Security
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
Spread Privacy
Spread Privacy
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
TaoSecurity Blog
TaoSecurity Blog
博客园 - 聂微东
Vercel News
Vercel News
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
B
Blog
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
Attack and Defense Labs
Attack and Defense Labs
L
LINUX DO - 最新话题
D
DataBreaches.Net
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - Franky
W
WeLiveSecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Check Point Blog
H
Hacker News: Front Page

wuxinhua.com Blog | RSS Feed

写作者与不写作者:AI 时代的思考分水岭 - wuxinhua.com 一文搞懂 Prompt Engineering - wuxinhua.com #30 AI 颠覆我对传统创业团队的认知 - wuxinhua.com 前端面试系列 - 手写代码 - wuxinhua.com #29 微软与 OpenAI 合作内幕 - wuxinhua.com #28 离 30 岁越来越远 - wuxinhua.com Add AI Chatbox to your VitePress document site - wuxinhua.com Building a Blog Subscription and Pusher with AirCode and Resend - wuxinhua.com #27 创始人是公司灵魂的守护者 - wuxinhua.com 快速上手 Midjourney AI 做图 - wuxinhua.com ChatGPT 机器人系列 - 用 JavaScript,五分钟将 Siri 接入 ChatGPT - wuxinhua.com ChatGPT 机器人系列 - 用 JavaScript 五分钟开发一个飞书 ChatGPT 机器人 - wuxinhua.com ChatGPT 机器人系列 - 用 JavaScript 开发企业微信 ChatGPT 聊天应用 - wuxinhua.com #26 SVB 硅谷银行为什么倒闭 - wuxinhua.com #25 人人都可以成为 AI 工程师 - wuxinhua.com #24 关注你身体的变化 - wuxinhua.com #23 Be positive - wuxinhua.com 前端面试系列 - 前端八股文 - wuxinhua.com #22 AI 在殖民,社交媒体在衰退 - wuxinhua.com #21 我了解到的新冠后遗症 - wuxinhua.com #20 关于死亡和告别 - wuxinhua.com #19 永远无法准备好 - wuxinhua.com macOS 前端开发环境配置 - wuxinhua.com 我的 Newsletter 321来信 - wuxinhua.com Node.js 包管理及 npm 依赖安装机制 - wuxinhua.com 知识的碎片(2021) - wuxinhua.com 放弃 newsfeed 拥抱 newsletter - wuxinhua.com 混迹于 Clubhouse 两周后的一些想法🤔 - wuxinhua.com 认识Docker - wuxinhua.com 知识的碎片(2020) - wuxinhua.com 初探 Web Components - wuxinhua.com Linux 命令行之 Crontab - wuxinhua.com 今年看的书📚(2019) - wuxinhua.com 适配 iOS 13 - wuxinhua.com React Native 新手常见问题及体验总结 - wuxinhua.com ES10(ECMAScript2019)特征预览 - wuxinhua.com Flexbox布局完全指南 - wuxinhua.com 今年看的书📚(2018) - wuxinhua.com 《从0到1 - 如何创造未来 》书评 - wuxinhua.com www背后的故事 - wuxinhua.com contenteditable 踩坑记 - wuxinhua.com Good Code vs Bad Code in Golang - wuxinhua.com 关于React的几道面试题 - wuxinhua.com SVG动画实践 - wuxinhua.com 今年看的书📚(2017) - wuxinhua.com 对比几种常见的排序算法 - wuxinhua.com React服务端渲染(SSR)初探 - wuxinhua.com 从面试题“输入URL...发生了什么”学到的(下) - wuxinhua.com 从面试题“输入URL...发生了什么?”学到的(上) - wuxinhua.com ES6(ECMAScript 6.0)新特征 - wuxinhua.com 对React-redux中connect方法的理解 - wuxinhua.com 我的 RSS 订阅列表 - wuxinhua.com 《空谷幽兰》书评 - wuxinhua.com 你可能不知道git rerere - wuxinhua.com webpack v2升级踩坑笔记 - wuxinhua.com
Building your first Discord ChatGPT Bot - wuxinhua.com
Step 2: Setting Scope and Authorization · 2023-05-18 · via wuxinhua.com Blog | RSS Feed

What we'll be building

In this tutorial, I will guide you through building your initial Discord app using JavaScript to interact with ChatGPT via slash commands.

Here's what the finished Discord ChatGPT Bot will look like:

Resources used in this guide

Step 1: Creating an App and Bot

First, you'll need to create an app in the developer portal if you don't have one already:

  1. Go to Discord Developer Portal. (login using your discord account if required). Click on the "New Application" button at the top right. Give your application a name and click "Create"

  1. Copy your Public Key and Application ID, and put them somewhere locally (we'll need these later)

  1. Click on the "Bot" tab on the left side of the screen.Click on the "Add Bot" button on the right. After the bot is created, Reset the token for your bot, and store it somewhere safe as a secret.(we'll need these later)

Once the application and bot is created, Here, you can customize them by adding an icon, description, etc.

Click on OAuth2 in the left sidebar, then select URL Generator.

Add two scopes:

  • applications.commands which allows your app to create commands. bot which adds your bot user.
  • After you select bot, you can also select different permissions for your bot. For now, just check Send Messages.

Copy the GENERATED URL from above, and paste it into your browser. You'll be guided through the installation flow, where you should make sure you're installing your app on a server where you can develop and test it.

After authorized your app, you can head over to your server and see that -> GPT hopped into the server. ✨

Step 3: Get a copy and Deploy

This guide uses AirCode to host code, Before we get a copy, make sure you have a AirCode account.

  1. Go to this Discord ChatGPT Bot Demo. Click on the "Get a copy" button.

  1. You'll be redirected to the Create app page, use the default name or type your own app name, then click "Create".

Paste the Bot token、OpenAI Key、Public Key、Application ID、earlier save from platform into the Environment variables. Make sure they are in the right key value place.

Click on the "Deploy" button to deploy all files, the env changes will take effect online after deployment.

Step 4: Register Command

The project contains a register command script you can use to install the commands, which is defined in register-command.js.

Select register-command.js file, you will find a invoke url as following, Copy the URL and paste it into your browser URL address.

You will register /chatgpt slash command into server.

Step 5: Handling Interactivity

To enable your app to receive slash command requests (and other interactions), Discord needs a public URL to send them.

Select interactions.js file, you will find a invoke URL as following, copy the link.

Back to Discord Applications, on your app's General Information page, there's an Interactive Endpoint URL option, where you can paste your interactions URL copied from AirCode.

Make sure the save is successful.

Test your ChatGPT bot by typing the command "/chatgpt".

Feedback

Join our Discord server for help and discussion.