-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #518 from gowon-bot/user-install
Support user installs
- Loading branch information
Showing
6 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v9"; | ||
import { SlashCommandBuilder } from "../../context/arguments/argumentTypes/SlashCommandTypes"; | ||
|
||
export class ConvertedSlashCommand { | ||
private isUserInstallable = false; | ||
|
||
constructor(private builder: SlashCommandBuilder) {} | ||
|
||
public toJSON(): RESTPostAPIApplicationCommandsJSONBody { | ||
const json = this.builder.toJSON(); | ||
|
||
if (this.isUserInstallable) { | ||
// Type is outdated | ||
(json as any).integration_types = [0, 1]; | ||
(json as any).contexts = [0, 1, 2]; | ||
} | ||
|
||
return json; | ||
} | ||
|
||
public setUserInstallable(toggle: boolean): this { | ||
this.isUserInstallable = toggle; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters