-
Notifications
You must be signed in to change notification settings - Fork 0
/
properties.js
55 lines (46 loc) · 1.51 KB
/
properties.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const {Revise}= require("revise-sdk");
const AUTH_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjA5OTVkZTEwLTBiM2MtNDVkYi1hMTZkLWY2MGVlNTYxMDQ5ZSIsImtleSI6Ink2OGQxY3B6IiwiaWF0IjoxNjg2MDUwNzY1fQ.G9sUzkOsKz3iCFmN1VAoCUut70MFZuqOYNJZSM0whD8";
const revise=new Revise({auth:AUTH_TOKEN});
const API=async function(){
const options=[
{
mood:'Angry',
stamina: "10",
level:"1",
image:"https://ipfs.io/ipfs/QmQGD89rmLQ67eoJ8ATc7QiT4iDo7tAgAeGf4QSRcF8uQ2?filename=angry.jpg",
},
{
mood:'Happy',
stamina:"20",
level:"2",
image:"https://ipfs.io/ipfs/QmSNwFe1KrYX5XdZNbo56DX2AuwEG81R1jKUiYewKLDSfP?filename=happy.jpg",
},
{
mood:'Shy',
stamina:"30",
level:"3",
image:"https://ipfs.io/ipfs/QmZJnWNaoLkTX1es1Ze146npAHcMdyqkhbH5XEY4qW8rF4?filename=hy.jpg",
},
]
const randomIndex = Math.floor(Math.random() * 3)
return options[randomIndex]
}
async function run() {
revise
.every('2m')
.listenTo(API)
.start(async (data) => {
const Gordon = await revise.fetchNFT(
'757142d1-bda2-429b-8df2-f1ff63783f6d',
)
revise
.nft(Gordon)
.setProperty('mood', data.mood)
.setProperty('stamina', data.stamina)
.setProperty('level', data.level)
.setImage(data.image)
.save()
console.log(`Current mood is : ${data.mood},stamina is : ${data.stamina} and level is : ${data.level} of Gordon Freeman!`)
})
}
run()