-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
57 lines (49 loc) · 1.48 KB
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { MessageEmbed } from 'discord.js';
export enum MessagePriority {
LOW,
MEDIUM,
HIGH,
BLACK,
}
export function setMessage(
title: string,
priority = -1,
description = ''
) {
return (
new MessageEmbed()
.setTitle(title)
.setDescription(description)
.setColor(getColorByPriority(priority))
);
}
export function getLowMsg(title: string, description = '') {
return setMessage(title, MessagePriority.LOW, description);
}
export function getMedMsg(title: string, description = '') {
return setMessage(title, MessagePriority.MEDIUM, description);
}
export function getHighMsg(title: string, description = '') {
return setMessage(title, MessagePriority.HIGH, description);
}
export function getDefinedMsg(title: string, description: string, img_url: string, timeCompleted: number) {
const msg =
new MessageEmbed()
.setTitle(title)
.setDescription(description)
.setColor(getColorByPriority(MessagePriority.LOW))
.setFooter(`Speed: ${timeCompleted}ms`)
;
if (img_url) msg.setThumbnail(img_url);
return msg;
}
export function capitalize(str: string) {
return str[0].toUpperCase() + str.substring(1);
}
export function getColorByPriority(priority: MessagePriority) {
if (MessagePriority.LOW == priority) return '#57E0B8';
if (MessagePriority.MEDIUM == priority) return '#FFD200';
if (MessagePriority.HIGH == priority) return '#FF559D';
if (MessagePriority.BLACK == priority) return '#6C00FF';
return '#aaaaaa'
}