質問編集履歴
1
ソースコード追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,103 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
![![イメージ説明](19107c141d323ecf06ddf4458fe83a45.png)](115a89ccfb1842b4ce004df34d7b3006.png)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
### 該当のソースコード
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
```ここに言語名を入力
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
function submit(){
|
22
|
+
|
23
|
+
discord(get_value())
|
24
|
+
|
25
|
+
};
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
function get_value() {
|
30
|
+
|
31
|
+
var sheet = get_sheet('スプシURL',0);
|
32
|
+
|
33
|
+
var range = sheet.getRange('A3:C4'); //ここの(1,1)は座標です。第一引数が行、第二引数が列です。
|
34
|
+
|
35
|
+
var value = range.getValue();
|
36
|
+
|
37
|
+
return value;
|
38
|
+
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
function get_sheet(gss_url,sheet_num) {
|
44
|
+
|
45
|
+
var ss = SpreadsheetApp.openByUrl(gss_url);
|
46
|
+
|
47
|
+
var sheet = ss.getSheets()[sheet_num];
|
48
|
+
|
49
|
+
return sheet;
|
50
|
+
|
51
|
+
};
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
function discord(message) {
|
56
|
+
|
57
|
+
const url = 'ウェブフック名';
|
58
|
+
|
59
|
+
const token = 'トークン名';
|
60
|
+
|
61
|
+
const channel = '#test';
|
62
|
+
|
63
|
+
const text = message;
|
64
|
+
|
65
|
+
const username = 'bot';
|
66
|
+
|
67
|
+
const parse = 'full';
|
68
|
+
|
69
|
+
const method = 'post';
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
const payload = {
|
74
|
+
|
75
|
+
'token' : token,
|
76
|
+
|
77
|
+
'channel' : channel,
|
78
|
+
|
79
|
+
"content" : text,
|
80
|
+
|
81
|
+
'username' : username,
|
82
|
+
|
83
|
+
'parse' : parse,
|
84
|
+
|
85
|
+
};
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
const params = {
|
90
|
+
|
91
|
+
'method' : method,
|
92
|
+
|
93
|
+
'payload' : payload,
|
94
|
+
|
95
|
+
'muteHttpExceptions': true
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
response = UrlFetchApp.fetch(url, params);
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
```
|