-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessageInterface.js
More file actions
110 lines (97 loc) · 3.17 KB
/
messageInterface.js
File metadata and controls
110 lines (97 loc) · 3.17 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const { ActionRowBuilder, ButtonBuilder, TextInputBuilder, ModalBuilder } = require('discord.js');
const dataInterface = require("./dataInterface.js");
module.exports = {
scoringPrompt: (memberId) => {
//TODO: action row is kinda ugly, set emojis for buttons
// create action row
const actionRow = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId(`one_${memberId}`)
.setLabel("JEDAN BOD")
.setStyle(1),
new ButtonBuilder()
.setCustomId(`two_${memberId}`)
.setLabel("DVA BODA")
.setStyle(1),
new ButtonBuilder()
.setCustomId(`oneSolo_${memberId}`)
.setLabel("JEDAN SOLO")
.setStyle(1),
new ButtonBuilder()
.setCustomId(`twoSolo_${memberId}`)
.setLabel("DVA SOLO")
.setStyle(1)
);
// TODO: get some bitchess
// also make prettier message
// reply with message and action row for each user
return {
content: `Points for ${dataInterface.nameById(memberId)}`,
components: [actionRow],
ephemeral: true
};
},
addDefaultNamePrompt: (memberId, memberDefaultName) => {
const actionRow = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId(`defaultRegister_${memberId}_${memberDefaultName}`)
.setLabel(`Add as ${memberDefaultName}`)
.setStyle(1),
new ButtonBuilder()
.setCustomId(`renamedRegister_${memberId}_${memberDefaultName}`)
.setLabel("Add renamed")
.setStyle(1),
new ButtonBuilder()
.setCustomId(`removeMessage`)
.setLabel("Do not add")
.setStyle(1)
);
return {
content: `Name ${memberDefaultName} not found, do you wish to add it?`,
components: [actionRow],
ephemeral: true
};
},
modalInputNamePrompt: (memberId, memberDefaultName = "") => {
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('Name input').addComponents(
new ActionRowBuilder().addComponents(
new TextInputBuilder()
.setCustomId(`register_${memberId}`)
.setRequired()
.setLabel(`Name for ${memberDefaultName}`)
.setStyle(1)
)
);
return modal;
},
scoreSuccessInfo: (name, date, points, solo = false) => {
return {
content: `:white_check_mark: Successfully entered ${points} points to ${name} on ${date}${solo ? "as a solo ride" : ""}.`,
components: [],
ephemeral: true
}
},
noName: (name) => {
return {
content: `:x: No person with name ${name}.`,
components: [],
ephemeral: true
}
},
soloLimit: (name) => {
return {
content: `:x: ${name} excceeded the number of solo rides this semester.`,
components: [],
ephemeral: true
}
},
critcalError: () => {
return {
content: `:x::x::x: Critical error occurred, contact the admins.`,
components: [],
ephemeral: true
}
}
}