Fix lint errors
This commit is contained in:
parent
778c4bbc78
commit
710c1dd1f1
10 changed files with 37 additions and 31 deletions
|
@ -49,6 +49,7 @@
|
|||
{
|
||||
"checksVoidReturn": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"no-void": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ function getBuildLinks(
|
|||
}
|
||||
|
||||
export default async function pobierz(client: Client, message: Discord.Message): Promise<void> {
|
||||
message.channel.startTyping();
|
||||
void message.channel.startTyping();
|
||||
|
||||
try {
|
||||
const betaBuild = await appVersion.getBetaBuild();
|
||||
|
@ -64,15 +64,15 @@ export default async function pobierz(client: Client, message: Discord.Message):
|
|||
.addField('Strona internetowa', 'https://wulkanowy.github.io/')
|
||||
.setColor('F44336')
|
||||
.addField('Wersja beta',
|
||||
`Aktualna wersja: **v${betaBuild.version}** opublikowana **${
|
||||
`${`Aktualna wersja: **v${betaBuild.version}** opublikowana **${
|
||||
moment(betaBuild.publishedAt)
|
||||
.tz('Europe/Warsaw')
|
||||
.calendar()
|
||||
.toLowerCase()
|
||||
}**\n`
|
||||
+ '[Sklep Play](https://play.google.com/store/apps/details?id=io.github.wulkanowy) | '
|
||||
+ `[GitHub](${betaBuild.url}) | `
|
||||
+ `[Direct](${betaBuild.directUrl})`);
|
||||
+ `[GitHub](${betaBuild.url}) | `}${betaBuild.directUrl === null
|
||||
? '' : `[Direct](${betaBuild.directUrl})`}`);
|
||||
|
||||
if (buildMessageRich.length < 1024) {
|
||||
embed.addField('Wersja DEV', buildMessageRich);
|
||||
|
@ -87,7 +87,7 @@ export default async function pobierz(client: Client, message: Discord.Message):
|
|||
await message.channel.send({ embed });
|
||||
}
|
||||
} catch (error) {
|
||||
await message.channel.send(`Błąd: \`${error.message}\``);
|
||||
await message.channel.send(`Błąd: \`${error instanceof Error ? error.message : 'Bardzo nietypowy błąd :confused:'}\``);
|
||||
}
|
||||
message.channel.stopTyping();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export default async function rola(
|
|||
await message.channel.send(`Nadano rolę ${role.name}`);
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
await message.channel.send(`Błąd:\n\`\`\`\n${error.message}\n\`\`\``);
|
||||
await message.channel.send(`Błąd:\n\`\`\`\n${error instanceof Error ? error.message : 'Bardzo nietypowy błąd :confused:'}\n\`\`\``);
|
||||
}
|
||||
} else if (args[0].toLowerCase() === 'usun' && args[1]) {
|
||||
const roleName = client.config.roles.find((e: string) => e === args[1].toLowerCase());
|
||||
|
@ -51,7 +51,7 @@ export default async function rola(
|
|||
await message.channel.send(`Odebrano rolę ${role.name}`);
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
await message.channel.send(`Błąd:\n\`\`\`\n${error.message}\n\`\`\``);
|
||||
await message.channel.send(`Błąd:\n\`\`\`\n${error instanceof Error ? error.message : 'Bardzo nietypowy błąd :confused:'}\n\`\`\``);
|
||||
}
|
||||
} else if (args[0].toLowerCase() === 'lista') {
|
||||
const availableRolesString = client.config.roles.map((e: string) => `\`${e}\``).join(', ');
|
||||
|
|
|
@ -7,7 +7,8 @@ export default async function status(
|
|||
message: Discord.Message,
|
||||
args: string[],
|
||||
): Promise<void> {
|
||||
message.channel.startTyping();
|
||||
void message.channel.startTyping();
|
||||
|
||||
let host: string;
|
||||
let symbol: string;
|
||||
let mobileUrl: string;
|
||||
|
@ -51,7 +52,7 @@ export default async function status(
|
|||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
message.channel.send(`Błąd: \`${error.message}\``);
|
||||
await message.channel.send(`Błąd: \`${error instanceof Error ? error.message : 'Bardzo nietypowy błąd :confused:'}\``);
|
||||
}
|
||||
|
||||
message.channel.stopTyping();
|
||||
|
|
|
@ -11,8 +11,8 @@ export default async function messageHandler(
|
|||
): Promise<void> {
|
||||
if (message.author.bot) return;
|
||||
|
||||
if (commandHandler(client, message)) return;
|
||||
if (await commandHandler(client, message)) return;
|
||||
if (await hastebinHandler(client, message)) return;
|
||||
repoHandler(client, message);
|
||||
issueHandler(client, message);
|
||||
await repoHandler(client, message);
|
||||
await issueHandler(client, message);
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ let lastStatusCode = 0;
|
|||
async function performCheck(): Promise<void> {
|
||||
try {
|
||||
statusChannels.forEach((statusChannel: Discord.TextChannel) => {
|
||||
statusChannel.startTyping();
|
||||
void statusChannel.startTyping();
|
||||
});
|
||||
lastStatusCode = await uonetStatus.sendStatusMessage(statusChannels, 'warszawa', lastStatusCode);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
statusChannels.forEach((statusChannel: Discord.TextChannel) => {
|
||||
statusChannel.send(`Błąd: \`${error.message}\``);
|
||||
});
|
||||
await Promise.all(statusChannels.map((statusChannel: Discord.TextChannel) => statusChannel.send(
|
||||
`Błąd: \`${error instanceof Error ? error.message : 'Bardzo nietypowy błąd :confused:'}\``,
|
||||
)));
|
||||
}
|
||||
|
||||
statusChannels.forEach((statusChannel: Discord.TextChannel) => {
|
||||
|
@ -23,35 +23,35 @@ async function performCheck(): Promise<void> {
|
|||
});
|
||||
}
|
||||
|
||||
export default function readyHandler(client: Client): void {
|
||||
export default async function readyHandler(client: Client): Promise<void> {
|
||||
statusChannels.push(client.channels.cache
|
||||
.find((ch: Discord.Channel) => ch.id === '522119365265588224') as Discord.TextChannel);
|
||||
|
||||
const statusCheckInterval = client.config.statusInterval * 1000;
|
||||
|
||||
setInterval((): void => {
|
||||
performCheck();
|
||||
void performCheck();
|
||||
}, statusCheckInterval);
|
||||
|
||||
client.user?.setActivity('od mniej niż minuty', {
|
||||
await client.user?.setActivity('od mniej niż minuty', {
|
||||
type: 'WATCHING',
|
||||
});
|
||||
|
||||
let activeTimeMinutes = 1;
|
||||
|
||||
setInterval(() => {
|
||||
setInterval(async () => {
|
||||
if (activeTimeMinutes >= 60 * 48) {
|
||||
const activeTimeDays = Math.floor(activeTimeMinutes / 60 / 24);
|
||||
client.user?.setActivity(`od ${activeTimeDays} dni`, {
|
||||
await client.user?.setActivity(`od ${activeTimeDays} dni`, {
|
||||
type: 'WATCHING',
|
||||
});
|
||||
} if (activeTimeMinutes >= 60) {
|
||||
const activeTimeHours = Math.floor(activeTimeMinutes / 60);
|
||||
client.user?.setActivity(activeTimeHours === 1 ? 'od godziny' : `od ${activeTimeHours} godzin`, {
|
||||
await client.user?.setActivity(activeTimeHours === 1 ? 'od godziny' : `od ${activeTimeHours} godzin`, {
|
||||
type: 'WATCHING',
|
||||
});
|
||||
} else {
|
||||
client.user?.setActivity(activeTimeMinutes === 1 ? 'od minuty' : `od ${activeTimeMinutes} minut`, {
|
||||
await client.user?.setActivity(activeTimeMinutes === 1 ? 'od minuty' : `od ${activeTimeMinutes} minut`, {
|
||||
type: 'WATCHING',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@ import Discord from 'discord.js';
|
|||
import Client from '../client';
|
||||
import commands from '../commands';
|
||||
|
||||
export default function commandHandler(client: Client, message: Discord.Message): boolean {
|
||||
export default async function commandHandler(
|
||||
client: Client,
|
||||
message: Discord.Message,
|
||||
): Promise<boolean> {
|
||||
if (message.content.startsWith(client.config.prefix)) {
|
||||
if (
|
||||
message.channel instanceof Discord.DMChannel
|
||||
|
@ -20,11 +23,11 @@ export default function commandHandler(client: Client, message: Discord.Message)
|
|||
const cmd = commands.get(commandName);
|
||||
|
||||
if (cmd) {
|
||||
cmd(client, message, args);
|
||||
await cmd(client, message, args);
|
||||
} else {
|
||||
const commandsFuzzySet = FuzzySet(Array.from(commands.keys()));
|
||||
const match = commandsFuzzySet.get(commandName, null, 0.5);
|
||||
message.channel.send(`Nie ma takiej komendy \`${client.config.prefix}${commandName}\`\n${match ? `Czy chodziło ci o \`${client.config.prefix}${match[0][1]}\`?\n` : ''}W celu uzyskania pomocy wpisz \`${client.config.prefix}pomoc\``);
|
||||
await message.channel.send(`Nie ma takiej komendy \`${client.config.prefix}${commandName}\`\n${match ? `Czy chodziło ci o \`${client.config.prefix}${match[0][1]}\`?\n` : ''}W celu uzyskania pomocy wpisz \`${client.config.prefix}pomoc\``);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -12,7 +12,8 @@ export default async function hastebinHandler(
|
|||
if (text.length === 0) return false;
|
||||
|
||||
try {
|
||||
message.channel.startTyping();
|
||||
void message.channel.startTyping();
|
||||
|
||||
const key = await hastebin.send(text);
|
||||
await message.channel.send({
|
||||
embed: {
|
||||
|
@ -29,7 +30,7 @@ export default async function hastebinHandler(
|
|||
message.channel.stopTyping();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await message.channel.send(`Błąd: \`${error.message}\``);
|
||||
await message.channel.send(`Błąd: \`${error instanceof Error ? error.message : 'Bardzo nietypowy błąd :confused:'}\``);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export default async function issueHandler(
|
|||
const issueMatches = Array.from(message.content.matchAll(issueRegex));
|
||||
|
||||
if (issueMatches.length > 0) {
|
||||
message.channel.startTyping();
|
||||
void message.channel.startTyping();
|
||||
|
||||
let repository = 'wulkanowy';
|
||||
switch (message.channel.id) {
|
||||
|
|
|
@ -15,7 +15,7 @@ export default async function repoHandler(
|
|||
const repoMatches = Array.from(message.content.matchAll(repoRegex));
|
||||
|
||||
if (repoMatches.length > 0) {
|
||||
message.channel.startTyping();
|
||||
void message.channel.startTyping();
|
||||
|
||||
const repoNames = _.uniqWith(
|
||||
repoMatches.map((repoMatch: RegExpMatchArray) => ({
|
||||
|
|
Loading…
Reference in a new issue