feat: added timezone help

This commit is contained in:
TresAbhi committed 2023-07-11 19:00:10 +00:00
1 parent 6c8f5ca478
commit fedad8df3e
2 files changed
+41 -25

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
# Timezones
What is considered a "day's worth of games" is determined by the reset time. The reset time is generally at midnight everyday after which newer games are counted towards the next day. Reset times vary from region to region:
- North America: UTC-5:00 (Central North American Time midnight)
- Europe: UTC+1:00 (Central European Time midnight)
- Asia: UTC+7:00 (Central Asia Standard Time midnight)
**Reset times are different from Blitz Stars** (Blitz Stars resets at 5:00 am locally relative to the user opening their website). Inconsistencies with Blitz Stars only occur with sleep-deprived players and players who play in the wrong region.
+32 -25
View File
@@ -1,44 +1,51 @@
import { SlashCommandBuilder } from 'discord.js';
import {
SlashCommandBuilder,
SlashCommandSubcommandsOnlyBuilder,
} from 'discord.js';
import {
COMMANDS_RAW,
CommandRegistry,
} from '../events/interactionCreate/index.js';
const RAW_PATH = `https://raw.githubusercontent.com/tresabhi/blitzkrieg/main/docs/`;
const DOCS: Record<string, string> = {
const DOCS = {
permissions: 'guide/permissions',
embeds: 'guide/embeds',
about: 'guide/about',
invite: 'guide/invite',
timezones: 'guide/timezones',
};
const DOC_DESCRIPTIONS: Record<keyof typeof DOCS, string> = {
permissions: 'The permissions needed for the bot to function',
embeds: 'How embeds work',
about: 'About the bot',
invite: 'How to invite the bot',
timezones: 'How Blitzkrieg infers and uses your timezone',
};
function addDocsSubcommands(option: SlashCommandSubcommandsOnlyBuilder) {
Object.entries(DOC_DESCRIPTIONS).forEach(([key, value]) => {
option.addSubcommand((sub) => sub.setName(key).setDescription(value));
});
return option;
}
export const helpCommand: CommandRegistry = {
inProduction: true,
inDevelopment: true,
inPublic: true,
command: new SlashCommandBuilder()
.setName('help')
.setDescription('All the help you need about the bot')
.addSubcommand((option) =>
option
.setName('commands')
.setDescription('List of all commands and their descriptions'),
)
.addSubcommand((option) =>
option
.setName('permissions')
.setDescription('The permissions needed for the bot to function'),
)
.addSubcommand((option) =>
option.setName('about').setDescription('About the bot'),
)
.addSubcommand((option) =>
option.setName('embeds').setDescription('How embeds work'),
)
.addSubcommand((option) =>
option.setName('invite').setDescription('How to invite the bot'),
),
command: addDocsSubcommands(
new SlashCommandBuilder()
.setName('help')
.setDescription('All the help you need about the bot')
.addSubcommand((option) =>
option
.setName('commands')
.setDescription('List of all commands and their descriptions'),
),
),
handler(interaction) {
const subcommand = interaction.options.getSubcommand();
@@ -54,7 +61,7 @@ export const helpCommand: CommandRegistry = {
.join('\n')}`;
}
const url = `${RAW_PATH}${DOCS[subcommand]}.md`;
const url = `${RAW_PATH}${DOCS[subcommand as keyof typeof DOCS]}.md`;
const content = fetch(url).then((response) => response.text());
return content;