基于区块链的毕业设计viber-bot – 毒蛇机器人

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计viber-bot – 毒蛇机器人 是一篇很好的国外资料

viber-bot

Create Viber Public Account

https://partners.viber.com/account/create-bot-account

Developer Documentation

https://developers.viber.com/docs/

Node.JS Bot API => https://developers.viber.com/docs/api/nodejs-bot-api/

For Node.JS,

Create a file .env in main directory and add this below text

VIBER_ACCESS_TOKEN=Your Viber Access Token Add HERE MONGODB_URI=Your Mongo DB Connection String Add Here WEBHOOK_URL=Your Heroku URL like https://yourappname.herokuapp.com PORT=3000 

For local testing

Install ngrok globally with command

npm install -g ngrok 

Clone project with

git clone https://github.com/YavorGrancharov/viber_bot.git 

Install all dependencies with

npm install 

Then, inside index.js file, replace this block of code:

app.listen(settings.port, async () => {   try {     console.log(`Application running on port: ${settings.port}`);     bot.setWebhook(`${process.env.WEBHOOK_URL}/viber/webhook`);   } catch (error) {     console.log('Can not set webhook on following server.');     console.error(error);     process.exit(1);   } });

with this one:

app.listen(settings.port, async () => {   try {     const publicUrl = await getPublicUrl();     console.log(`Application running on port: ${settings.port}`);     console.log('publicUrl => ', publicUrl);     bot.setWebhook(`${publicUrl}/viber/webhook`);   } catch (error) {     console.log('Can not set webhook on following server.');     console.error(error);     process.exit(1);   } });

And run project using commands npm run ngrok and npm run start on two separate terminals

You can see it running on localhost:3000


viber bot

创建viber公共帐户

https://partners.viber.com/account/create-bot-account

开发者文档

https://developers.viber.com/docs/

Node.JS Bot API=>https://developers.viber.com/docs/api/nodejs-bot-api/

For Node.JS,

在主目录中创建一个文件.env,并将其添加到下面的文本中

VIBER_ACCESS_TOKEN=Your Viber Access Token Add HERE MONGODB_URI=Your Mongo DB Connection String Add Here WEBHOOK_URL=Your Heroku URL like https://yourappname.herokuapp.com PORT=3000 

对于本地测试

使用命令全局安装ngrok

npm install -g ngrok 

使用

git clone https://github.com/YavorGrancharov/viber_bot.git 

使用安装所有依赖项

npm install 

克隆项目,然后在index.js文件中,将此代码块替换为以下代码块:

app.listen(settings.port, async () => {   try {     console.log(`Application running on port: ${settings.port}`);     bot.setWebhook(`${process.env.WEBHOOK_URL}/viber/webhook`);   } catch (error) {     console.log('Can not set webhook on following server.');     console.error(error);     process.exit(1);   } });

并在两个单独的终端上使用命令npm run ngrok和npm run start运行project

app.listen(settings.port, async () => {   try {     const publicUrl = await getPublicUrl();     console.log(`Application running on port: ${settings.port}`);     console.log('publicUrl => ', publicUrl);     bot.setWebhook(`${publicUrl}/viber/webhook`);   } catch (error) {     console.log('Can not set webhook on following server.');     console.error(error);     process.exit(1);   } });

您可以看到它在本地主机上运行:3000

You can see it running on localhost:3000

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/24113.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计viber-bot – 毒蛇机器人

提供最优质的资源集合

立即查看 了解详情