-
Notifications
You must be signed in to change notification settings - Fork 0
/
lost_in_cpc.js
137 lines (133 loc) · 3.33 KB
/
lost_in_cpc.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
await lib.discord.interactions['@0.0.0'].followups.ephemeral.create({
token: `${context.params.event.token}`,
content: `https://i.ibb.co/b2WC5D4/thend.gif`
/* embeds: [
{
"type": "rich",
"title": "",
"description": "",
"color": 0x00FFFF,
"image": {
"url": `https://i.ibb.co/b2WC5D4/thend.gif`,
"height": 0,
"width": 400
}
}
]*/
});
await lib.discord.interactions['@0.0.0'].followups.ephemeral.create({
token: `${context.params.event.token}`,
content: `Bravo! Vous avez trouvé tous les secrets de ce voyage dans les univers de SRAM, mais aussi de........ La fin? Quelle fin? M'enfin! Je veux la trouver cette fin! Je veux explorer, résoudre des énigmes, éviter les pièges, améliorer mes compétences, je veux la mériter, cette fin! Cachez cette fin que je ne saurais voir! Et démarrons cette aventure!!`,
});
await lib.discord.channels['@0.2.0'].messages.create({
"channel_id": `${context.params.event.channel_id}`,
"content": `>DEPART:`,
"tts": false,
"components": [
{
"type": 1,
"components": [
{
"style": 1,
"label": `OUEST`,
"custom_id": `adv_ouest`,
"disabled": false,
"type": 2
},
{
"style": 1,
"label": `NORD`,
"custom_id": `adv_nord`,
"disabled": false,
"type": 2
},
{
"style": 1,
"label": `EST`,
"custom_id": `adv_est`,
"disabled": false,
"type": 2
},
{
"style": 1,
"label": `SUD`,
"custom_id": `adv_sud`,
"disabled": false,
"type": 2
}
]
}
],
"embeds": [
{
"type": "rich",
"title": "",
"description": "",
"color": 0x00FFFF,
"image": {
"url": `https://i.ibb.co/swHGNb9/x100y100.png`,
"height": 0,
"width": 400
}
}
]
});
//set in google sheet the position to Start for this channel id
let result = await lib.googlesheets.query['@0.3.0'].select({
range: `adventure!A:C`,
bounds: 'FIRST_EMPTY_ROW',
where: [
{
'channel_id': `${context.params.event.channel_id}`
}
],
limit: {
'count': 0,
'offset': 0
}
});
console.log(result.rows.length);
if (result.rows.length == 0) {
await lib.googlesheets.query['@0.3.0'].insert({
range: `adventure!A:I`,
fieldsets: [{
'channel_id': `${context.params.event.channel_id}`,
'position': `5050`,
'gamemaster': `${context.params.event.member.user.id}`,
'aco': 0,
'botw': 0,
'xcx': 0,
'ds': 0,
'tess': 0,
'ngp': 0
}],
});
}
else{
await lib.googlesheets.query['@0.3.0'].update({
range: `adventure!A:I`,
bounds: 'FIRST_EMPTY_ROW',
where: [
{
'channel_id': `${context.params.event.channel_id}`,
}
],
limit: {
'count': 0,
'offset': 0
},
fields: {
'position': `5050`,
'gamemaster': `${context.params.event.member.user.id}`,
'aco': 0,
'botw': 0,
'xcx': 0,
'ds': 0,
'tess': 0,
'ngp': 0
}
});
}