Commit 746f238 1 parent 35309db commit 746f238 Copy full SHA for 746f238
File tree 5 files changed +19
-11
lines changed
5 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ import type {
3
3
APIApplicationCommand ,
4
4
RESTPostAPIApplicationCommandsJSONBody ,
5
5
} from 'discord-api-types/v9'
6
- import type { CommandInteraction } from 'discord.js'
7
- import { DiscordCommandOption } from './CommandOption'
6
+ import type { CommandInteraction , InteractionReplyOptions } from 'discord.js'
7
+ import type { DiscordCommandOption } from './CommandOption'
8
8
9
9
export interface IDiscordCommandConfig {
10
10
name : string
@@ -16,7 +16,11 @@ export interface IDiscordCommandConfig {
16
16
17
17
export type DiscordCommandHandler = (
18
18
interaction : CommandInteraction
19
- ) => string | undefined | Promise < string | undefined >
19
+ ) =>
20
+ | string
21
+ | undefined
22
+ | InteractionReplyOptions
23
+ | Promise < string | undefined | InteractionReplyOptions >
20
24
21
25
export type CreateDiscordCommandInput = IDiscordCommandConfig & {
22
26
handler : DiscordCommandHandler
Original file line number Diff line number Diff line change 1
1
import { createCommand , createOption } from '$discord'
2
- import type { CommandInteraction } from 'discord.js'
2
+ import type { CommandInteraction , InteractionReplyOptions } from 'discord.js'
3
3
4
4
const repository = createOption ( {
5
5
name : 'repository' ,
@@ -33,7 +33,9 @@ const command = createCommand({
33
33
name : 'contribute' ,
34
34
description : 'Learn how to contribute to an Amplify project' ,
35
35
options : [ repository ] ,
36
- handler : ( interaction : CommandInteraction ) => {
36
+ handler : (
37
+ interaction : CommandInteraction
38
+ ) : InteractionReplyOptions | string => {
37
39
const [ { value : repository } ] = interaction . options . data
38
40
const lines = [
39
41
'Thanks for your interest in contributing! To learn how to get started visit the contributing guide:' ,
Original file line number Diff line number Diff line change 1
1
import { createCommand , createOption } from '$discord'
2
- import type { CommandInteraction } from 'discord.js'
2
+ import type { CommandInteraction , InteractionReplyOptions } from 'discord.js'
3
3
4
4
const repository = createOption ( {
5
5
name : 'repository' ,
@@ -30,7 +30,9 @@ const command = createCommand({
30
30
name : 'github' ,
31
31
description : 'Gives link to GitHub repository' ,
32
32
options : [ repository ] ,
33
- handler : ( interaction : CommandInteraction ) => {
33
+ handler : (
34
+ interaction : CommandInteraction
35
+ ) : InteractionReplyOptions | string => {
34
36
const [ { value : repository } ] = interaction . options . data
35
37
return getRepositoryUrl ( repository as string )
36
38
} ,
Original file line number Diff line number Diff line change 1
1
import { createCommand } from '$discord'
2
- import type { Role , User } from 'discord.js'
2
+ import type { Role , User , InteractionReplyOptions } from 'discord.js'
3
3
4
- async function handler ( interaction ) {
4
+ async function handler ( interaction ) : Promise < InteractionReplyOptions | string > {
5
5
const { member : caller , guild } = interaction
6
6
const { role, user } = interaction . options . data . reduce (
7
7
( acc , current , index , source ) => {
Original file line number Diff line number Diff line change 1
1
import { MessageEmbed } from 'discord.js'
2
2
import { createCommand , createOption } from '$discord'
3
- import type { ThreadChannel } from 'discord.js'
3
+ import type { InteractionReplyOptions , ThreadChannel } from 'discord.js'
4
4
import { prisma } from '$lib/db'
5
5
6
6
export const PREFIXES = {
7
7
solved : '✅ - ' ,
8
8
open : '﹖ - ' ,
9
9
}
10
10
11
- async function handler ( interaction ) {
11
+ async function handler ( interaction ) : Promise < InteractionReplyOptions | string > {
12
12
const channel = interaction . channel as ThreadChannel
13
13
const messages = await channel . messages . fetch ( )
14
14
const record = await prisma . question . findUnique ( {
You can’t perform that action at this time.
0 commit comments