-
Notifications
You must be signed in to change notification settings - Fork 0
hotfix: remove webhook URL #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,35 @@ | ||
| import type { FC } from "react"; | ||
| import type { FC } from 'react'; | ||
|
|
||
| type Props = { | ||
| historyData: { | ||
| id: number; | ||
| from: string; | ||
| to: string; | ||
| amount: number; | ||
| }[] | undefined | ||
| } | ||
| historyData: | ||
| | { | ||
| id: number; | ||
| from: string; | ||
| to: string; | ||
| amount: number; | ||
| }[] | ||
| | undefined; | ||
| }; | ||
|
|
||
| const ReminderTest: FC<Props> = (props) => { | ||
| const discordWebhookUrl = "https://discord.com/api/webhooks/1430405385671671858/EZZlF3vrhVw-zwhBg9OVVuINsOJHSc-NneYRfVKzR-V32Ng76lYLcByOnVKCkNuVrIfG"; | ||
| const discordWebhookUrl = ''; | ||
|
|
||
| const onClick = () => { | ||
| if (confirm("Discordにリマインダが送信されます。よろしいですか?")) { | ||
| const message = props.historyData === undefined | ||
| ? "No data" | ||
| : props.historyData.map((v) => `返金の流れ: ${v.to} -> ${v.from}\n\t金額: ${v.amount}\n`).join("\n"); | ||
| if (confirm('Discordにリマインダが送信されます。よろしいですか?')) { | ||
| const message = | ||
| props.historyData === undefined | ||
| ? 'No data' | ||
| : props.historyData.map((v) => `返金の流れ: ${v.to} -> ${v.from}\n\t金額: ${v.amount}\n`).join('\n'); | ||
|
|
||
| fetch(discordWebhookUrl, { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify({ content: `==========\n@gangbujun_25033 \n現在残っている返金\n${message}` }), | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| return( | ||
| <button onClick={onClick}>リマインダーを送る</button> | ||
| ) | ||
| return <button onClick={onClick}>リマインダーを送る</button>; | ||
| }; | ||
|
|
||
| export default ReminderTest; | ||
| export default ReminderTest; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,8 +19,7 @@ export interface Env { | |
|
|
||
| export default { | ||
| async scheduled(controller: ScheduledController, env: Env, ctx: ExecutionContext) { | ||
| const webhookUrl = | ||
| 'https://discord.com/api/webhooks/1441344649863364608/vzOVqSEeNtjavKfq9MJaNoCB402dd_2W6J3BBr2nHFRngXEPaUm3r0IsvSs41ZIrSahz'; | ||
| const webhookUrl = ''; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the scheduled worker runs, Useful? React with 👍 / 👎.
|
||
|
|
||
| // DBのデータを取得 | ||
| const data: string = await reminder(env.API_URL); | ||
|
|
@@ -31,17 +30,20 @@ export default { | |
| body: JSON.stringify({ content: data }), | ||
| }); | ||
|
|
||
| const webhookUrlTest = 'https://discord.com/api/webhooks/1442164725273071649/SVu-eSyDZJ2pwXHOUFALlm0D8GtoeWS1oZzmJJan-H65Y9p3I3_Zmd4ysZL7vBo4vU-p'; | ||
|
|
||
| const historyData = [{ | ||
| to: "そぽたん", | ||
| from: "れん", | ||
| amount: 1000 | ||
| }, { | ||
| to: "そぽたん", | ||
| from: "ひろと", | ||
| amount: 2000 | ||
| }]; | ||
| const webhookUrlTest = ''; | ||
|
||
|
|
||
| const historyData = [ | ||
| { | ||
| to: 'そぽたん', | ||
| from: 'れん', | ||
| amount: 1000, | ||
| }, | ||
| { | ||
| to: 'そぽたん', | ||
| from: 'ひろと', | ||
| amount: 2000, | ||
| }, | ||
| ]; | ||
|
|
||
| const message = historyData.map((v) => `返金の流れ: ${v.to} -> ${v.from}\n\t金額: ${v.amount}\n`).join('\n'); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting webhook URL to empty string will cause the fetch call to fail. The code attempts to fetch an invalid URL (''), which will throw an error when the button is clicked. Consider using environment variables to store the webhook URL securely (e.g., import.meta.env.VITE_DISCORD_WEBHOOK_URL), or add a check to disable the button or skip the fetch if the URL is not configured.