Strongly typed config (and ts strict mode)
This commit is contained in:
parent
36c05556e5
commit
4585f60af7
7 changed files with 31 additions and 16 deletions
|
|
@ -11,8 +11,9 @@ import {
|
|||
} from "discord.js";
|
||||
|
||||
import { getSongOnPreferredProvider } from "../helper.ts"
|
||||
import { Config } from "../config.ts";
|
||||
|
||||
function keepV(url) {
|
||||
function keepV(url: string): string {
|
||||
const urlObj = new URL(url);
|
||||
const vParam = urlObj.searchParams.get("v");
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ function keepV(url) {
|
|||
}
|
||||
|
||||
export default class PingCommand extends Command {
|
||||
async run(interaction: ChatInputCommandInteraction, config) {
|
||||
async run(interaction: ChatInputCommandInteraction, config: Config) {
|
||||
await interaction.deferReply()
|
||||
|
||||
|
||||
|
|
@ -76,4 +77,4 @@ export default class PingCommand extends Command {
|
|||
InteractionContextType.Guild,
|
||||
InteractionContextType.PrivateChannel
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import {
|
|||
InteractionContextType,
|
||||
SlashCommandBuilder
|
||||
} from "discord.js";
|
||||
import { Config } from "../config.ts";
|
||||
|
||||
export default class PingCommand extends Command {
|
||||
async run(interaction: ChatInputCommandInteraction, config) {
|
||||
async run(interaction: ChatInputCommandInteraction, config: Config) {
|
||||
await interaction.reply({
|
||||
content: 'Pong!',
|
||||
});
|
||||
|
|
@ -23,4 +24,4 @@ export default class PingCommand extends Command {
|
|||
InteractionContextType.Guild,
|
||||
InteractionContextType.PrivateChannel
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import {
|
|||
InteractionContextType,
|
||||
SlashCommandBuilder
|
||||
} from "discord.js";
|
||||
import { Config } from "../config.ts";
|
||||
|
||||
export default class PingCommand extends Command {
|
||||
async run(interaction: ChatInputCommandInteraction, config) {
|
||||
async run(interaction: ChatInputCommandInteraction, config: Config) {
|
||||
const repo = interaction.options.getString("repo")
|
||||
const meow = await fetch(config.gitapi + repo).then(res => res.json());
|
||||
const embed = new EmbedBuilder()
|
||||
|
|
@ -38,4 +39,4 @@ export default class PingCommand extends Command {
|
|||
InteractionContextType.Guild,
|
||||
InteractionContextType.PrivateChannel
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue