Skip to content

Commit

Permalink
Merge pull request #4 from GDGoC-YNU/shion/disable-proxy
Browse files Browse the repository at this point in the history
デバッグ用Proxyの無効化
  • Loading branch information
Shion1305 authored Nov 30, 2024
2 parents c861750 + 16f0514 commit c4459fc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
1 change: 0 additions & 1 deletion discord_oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func (r DiscordOAuth2Resolver) GetGuildMemberStatus(accessToken, guildID, userID
targetUrl := fmt.Sprintf("https://discord.com/api/users/@me/guilds/%s/member", guildID)
rt := resty.New()
resp, err := rt.
SetProxy("http://localhost:9000").
R().
SetAuthToken(accessToken).
Get(targetUrl)
Expand Down
35 changes: 35 additions & 0 deletions gas/form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function onFormSubmit(e) {
const formResponses = e.response.getItemResponses();
const targetQuestionTitle = "管理用ID"; // 特定の質問タイトル
let userID = null;
for (var i = 0; i < formResponses.length; i++) {
var itemResponse = formResponses[i];
if (itemResponse.getItem().getTitle().startsWith(targetQuestionTitle)) {
userID = itemResponse.getResponse(); // 回答を取得
break;
}
}
if (!userID) {
Logger.log("Could not identify the user ID.");
return;
}
Logger.log("Submitted user ID: " + userID);

try {
let endpointUrl = "https://bot.gdgoc-ynu.shion.pro/api/initial/form/submit"
var payload = {"user_id": userID}
var options = {
method: "post",
contentType: "application/json",
payload: JSON.stringify(payload)
};
var resp = UrlFetchApp.fetch(endpointUrl, options);
if (resp.getResponseCode() === 200) {
Logger.log("Successfully notified to the server.");
}else {
Logger.log("Failed to send the form data to the server, response code: " + resp.getResponseCode());
}
} catch (error) {
Logger.log("Caught error: " + error.message);
}
}

0 comments on commit c4459fc

Please sign in to comment.