Merge branch 'rewrite' of github.com:Oliver-Akins/Quote-Bracket into rewrite
This commit is contained in:
commit
173dc01351
3 changed files with 17 additions and 15 deletions
|
|
@ -1,11 +1,12 @@
|
||||||
export var BRACKET_DATA = {
|
export var BRACKET_DATA: bracket_data = {
|
||||||
msg: "",
|
msg: "",
|
||||||
quotes: [],
|
quotes: [],
|
||||||
votes: {},
|
|
||||||
users: {},
|
users: {},
|
||||||
|
channel: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export var CHANNEL_DATA = {
|
export var CHANNEL_DATA: channel_data = {
|
||||||
|
version: 2,
|
||||||
webhook: {
|
webhook: {
|
||||||
token: "",
|
token: "",
|
||||||
id: "",
|
id: "",
|
||||||
|
|
|
||||||
|
|
@ -64,12 +64,10 @@ export default {
|
||||||
auth: request.auth,
|
auth: request.auth,
|
||||||
});
|
});
|
||||||
let data = JSON.parse(r.payload);
|
let data = JSON.parse(r.payload);
|
||||||
var winner_count = data.count;
|
|
||||||
|
|
||||||
// Check if we are getting rid of all winners
|
// Check if we are getting rid of all winners
|
||||||
if (data.eliminate_all) {
|
if (data.eliminate_all) {
|
||||||
quotes = [];
|
quotes = [];
|
||||||
winner_count = 0;
|
|
||||||
} else {
|
} else {
|
||||||
quotes = data.winners;
|
quotes = data.winners;
|
||||||
};
|
};
|
||||||
|
|
@ -105,11 +103,11 @@ export default {
|
||||||
type: 3,
|
type: 3,
|
||||||
custom_id: `quote`,
|
custom_id: `quote`,
|
||||||
placeholder: `Choose Your Favourite Quote`,
|
placeholder: `Choose Your Favourite Quote`,
|
||||||
options: quotes.map((_, i) => {
|
options: quotes.map((quote, i) => {
|
||||||
return {
|
return {
|
||||||
label: `Quote ${i + 1}`,
|
label: `Quote ${i + 1}`,
|
||||||
value: i,
|
value: i,
|
||||||
emoji: i < winner_count ? {
|
emoji: quote.win_streak > 0 ? {
|
||||||
name: `👑`
|
name: `👑`
|
||||||
} : null
|
} : null
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +134,7 @@ export default {
|
||||||
components: [],
|
components: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (extra_buttons.includes(`historyLink`)) {
|
if (extra_buttons.includes(`historyLink`) && config.server.history_site_base) {
|
||||||
actionRow.components.push(historyLinkButton(gID));
|
actionRow.components.push(historyLinkButton(gID));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
7
server/src/types/database.d.ts
vendored
7
server/src/types/database.d.ts
vendored
|
|
@ -12,14 +12,17 @@ interface bracket_data {
|
||||||
users: { [index: string]: number };
|
users: { [index: string]: number };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface database {
|
interface channel_data {
|
||||||
[index: string]: {
|
version: 2,
|
||||||
webhook: {
|
webhook: {
|
||||||
id: string;
|
id: string;
|
||||||
token: string;
|
token: string;
|
||||||
};
|
};
|
||||||
bracket: bracket_data;
|
bracket: bracket_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface database {
|
||||||
|
[index: string]: channel_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface bracket_history {
|
interface bracket_history {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue