2023-10-11 18:26:35 -05:00
|
|
|
import { ChatInputCommandInteraction } from 'discord.js';
|
2024-03-09 12:05:28 -06:00
|
|
|
import { translator } from '../localization/translator';
|
2023-10-14 11:36:10 -05:00
|
|
|
import buttonPrimary from './buttonPrimary';
|
2023-10-11 18:26:35 -05:00
|
|
|
|
2023-10-14 11:36:10 -05:00
|
|
|
export function buttonRefresh(
|
2023-10-11 18:26:35 -05:00
|
|
|
interaction: ChatInputCommandInteraction,
|
|
|
|
|
path: string,
|
|
|
|
|
) {
|
2024-03-09 12:05:28 -06:00
|
|
|
const { t } = translator(interaction.locale);
|
|
|
|
|
|
2023-10-11 18:26:35 -05:00
|
|
|
if (
|
2024-03-06 16:19:29 -06:00
|
|
|
interaction.appPermissions?.has('ReadMessageHistory') &&
|
2023-10-11 18:26:35 -05:00
|
|
|
interaction.appPermissions?.has('ViewChannel')
|
|
|
|
|
) {
|
2024-03-09 12:05:28 -06:00
|
|
|
return buttonPrimary(path, t`bot.common.buttons.refresh`);
|
2023-10-11 18:26:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|