Split the dev buttons off into better controls
This commit is contained in:
parent
f44d1d35e2
commit
c0a1f4be2e
2 changed files with 30 additions and 14 deletions
|
|
@ -4,6 +4,10 @@ import { getQuote } from "@/utils/quotes";
|
||||||
import { db, config } from "@/main";
|
import { db, config } from "@/main";
|
||||||
import { BRACKET_DATA, DISCORD_API_URI } from "@/constants";
|
import { BRACKET_DATA, DISCORD_API_URI } from "@/constants";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { deleteVoteButton } from "@/utils/components/buttons/delete_vote";
|
||||||
|
import { showUserVoteButton } from "@/utils/components/buttons/my_vote";
|
||||||
|
import { viewDBButton } from "@/utils/components/buttons/view_db";
|
||||||
|
import { countVotesButton } from "@/utils/components/buttons/count_votes";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
method: `POST`, path: `/{guild_id}/bracket`,
|
method: `POST`, path: `/{guild_id}/bracket`,
|
||||||
|
|
@ -109,23 +113,33 @@ export default {
|
||||||
{
|
{
|
||||||
type: 1,
|
type: 1,
|
||||||
components: [
|
components: [
|
||||||
{
|
showUserVoteButton,
|
||||||
type: 2,
|
deleteVoteButton,
|
||||||
style: 1,
|
],
|
||||||
label: `What Did I Vote For?`,
|
|
||||||
custom_id: `showMyVote`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 2,
|
|
||||||
style: 4,
|
|
||||||
label: `Remove Vote`,
|
|
||||||
custom_id: `deleteVote`
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------
|
||||||
|
// Add the extra buttons as desired
|
||||||
|
let extra_buttons = config.guilds[gID].extra_buttons ?? [];
|
||||||
|
if (extra_buttons.length > 0) {
|
||||||
|
let actionRow: action_row = {
|
||||||
|
type: 1,
|
||||||
|
components: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
if (extra_buttons.includes(`DB`)) {
|
||||||
|
actionRow.components.push(viewDBButton);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (extra_buttons.includes(`voteCount`)) {
|
||||||
|
actionRow.components.push(countVotesButton);
|
||||||
|
};
|
||||||
|
|
||||||
|
message.components.push(actionRow);
|
||||||
|
};
|
||||||
|
|
||||||
// Add the development-only buttons if needed
|
// Add the development-only buttons if needed
|
||||||
if (config.discord.dev_buttons) {
|
if (config.discord.dev_buttons) {
|
||||||
message.components.push({
|
message.components.push({
|
||||||
|
|
|
||||||
4
src/types/config.d.ts
vendored
4
src/types/config.d.ts
vendored
|
|
@ -6,7 +6,9 @@ interface channel_config {
|
||||||
delete_mode: "remove_components" | "delete_message";
|
delete_mode: "remove_components" | "delete_message";
|
||||||
params: { [index: string]: any };
|
params: { [index: string]: any };
|
||||||
thread_name?: string;
|
thread_name?: string;
|
||||||
include_jump_link_for_threads?: boolean;
|
show_win_streak?: boolean;
|
||||||
|
extra_buttons?: string[];
|
||||||
|
tie_reminder: "channel" | "thread" | "thread_no_jump_link";
|
||||||
}
|
}
|
||||||
|
|
||||||
interface config {
|
interface config {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue