Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

/uploadコマンドが一部ファイルに対応していない問題を修正 (#77) #90

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
TSの書き方
  • Loading branch information
takejohn committed Apr 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit ff9577fca41b1bed635e0d579db3f908ad5ed801
17 changes: 9 additions & 8 deletions packages/cdn/upload.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
const axios = require('axios').default;
const FormData = require('form-data');
const config = require('../../config.json');
const { LANG, strFormat } = require('../../util/languages');
import axios from 'axios';
import FormData from 'form-data';
import config from '../../internal/config';
import { LANG, strFormat } from '../../util/languages';

export default {
data: new SlashCommandBuilder()
@@ -47,12 +47,13 @@ export default {
responseType: 'stream',
});
const form = new FormData();
const filename = interaction.options.get(
const filename = interaction.options.getString(
LANG.commands.upload.options.filename.name,
)?.value;
);
const isPrivate =
interaction.options.get(LANG.commands.upload.options.private.name)
?.value == true;
interaction.options.getBoolean(
LANG.commands.upload.options.private.name,
) == true;
console.log(strFormat(LANG.commands.upload.isPrivateLog, [isPrivate]));
form.append('file', res.data, filename || file.name);
const res2 = await axios.post(config.cdnUploadURL, form, {