Skip to content

Commit

Permalink
fix: エンコーディングした
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryoga-exe committed Jul 18, 2022
1 parent 6775e95 commit 835e40b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/commands/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ const Data: ApplicationCommandData = {

const Response = async (interaction: CommandInteraction, dbUrl: any) => {
const tag = interaction.options.getString("tag");
const url = dbUrl+`?tag=${tag}`;
if (!tag) {
// ほかの人からは見えない設定
await interaction.reply({ content: "ERROR! タグが指定されていません!", ephemeral: true });
return;
}
const url = dbUrl+`?tag=${encodeURIComponent(tag)}`;
await interaction.deferReply();
const response = await fetch(url);
// レスポンスがきちんと返ってきた
if (response.ok) {
const books = await response.json() as Array<string>;
if (books.length == 0) {
Expand Down

0 comments on commit 835e40b

Please sign in to comment.