-
Notifications
You must be signed in to change notification settings - Fork 2
/
staff.js
224 lines (217 loc) · 9.9 KB
/
staff.js
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
const App = () => {
const [showForm, setShowForm] = React.useState(true);
const [form, setForm] = React.useState({
name: '',
age: '',
discord: '',
exp: '',
why: '',
whyYou: '',
sc1: '',
sc2: '',
sc3: '',
sc4: ''
});
const [status, setStatus] = React.useState('');
const wh1 = "https://discord.com/api/webhooks/";
const wh2 = "1323757525094371360/";
const wh3 = "dvJ8zF_y8-xr_o21rc1-nofCUGTQZLEbfcPO_XcZYDKaQiX8c17r9bo_Xkdkig7N0Lxs";
//dont spam this webhook or il break your knecaps
React.useEffect(() => {
fetch('showhide.json')
.then(res => res.json())
.then(data => {
setShowForm(data.showModApplications);
})
.catch(err => {
console.error('Error loading application state:', err);
});
}, []);
const submit = async (e) => {
e.preventDefault();
try {
const webhookUrl = wh1 + wh2 + wh3;
const embedData = {
embeds: [{
title: '📝 New Moderator Application',
color: 5793266,
fields: [
{
name: 'Minecraft username',
value: form.name,
inline: true
},
{
name: 'Age',
value: form.age,
inline: true
},
{
name: 'Discord username',
value: form.discord,
inline: true
},
{
name: 'Previous experience',
value: form.exp || 'None provided'
},
{
name: 'Why they want to be a mod',
value: form.why || 'No reason provided'
},
{
name: 'Why choose them',
value: form.whyYou || 'Not specified'
},
{
name: 'A member is harassing others in chat with offensive language. What would you do?',
value: form.sc1 || 'No response'
},
{
name: 'You catch a member using forbidden client modifications(hacks/cheats). What would you do?',
value: form.sc2 || 'No response'
},
{
name: 'A member is being negative in in game chat, demanding redos, accusing everyone of cheating, and demanding the mods ban people. What would you do?',
value: form.sc3 || 'No response'
},
{
name: 'You discover players exploiting a game-breaking bug. What would you do?',
value: form.sc4 || 'No response'
}
],
timestamp: new Date().toISOString()
}]
};
const res = await fetch(webhookUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(embedData)
});
if (res.ok) {
setStatus('success');
setForm({
name: '',
age: '',
discord: '',
exp: '',
why: '',
whyYou: '',
sc1: '',
sc2: '',
sc3: '',
sc4: ''
});
} else {
console.error('Webhook error:', await res.text());
setStatus('error');
}
} catch (err) {
console.error('Submission error:', err);
setStatus('error');
}
};
if (!showForm) {
return React.createElement('div', { className: 'application-closed' },
React.createElement('h2', null, 'Application Closed'),
React.createElement('p', null, 'We are not accepting Moderator applications at this time.')
);
}
return React.createElement('div', { className: 'application-container' },
React.createElement('div', { className: 'application-form' },
React.createElement('h2', null, 'Moderator Application'),
React.createElement('form', { onSubmit: submit },
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'Minecraft Username'),
React.createElement('input', {
required: true,
value: form.name,
onChange: (e) => setForm({...form, name: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'Age'),
React.createElement('input', {
required: true,
type: 'number',
value: form.age,
onChange: (e) => setForm({...form, age: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'Discord Username'),
React.createElement('input', {
required: true,
value: form.discord,
onChange: (e) => setForm({...form, discord: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'Previous Experience'),
React.createElement('textarea', {
required: true,
value: form.exp,
onChange: (e) => setForm({...form, exp: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'Why do you want to join our mod team?'),
React.createElement('textarea', {
required: true,
value: form.why,
onChange: (e) => setForm({...form, why: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'Why should we accept you over other applicants?'),
React.createElement('textarea', {
required: true,
value: form.whyYou,
onChange: (e) => setForm({...form, whyYou: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'A member is harassing others in chat with offensive language. What would you do?'),
React.createElement('textarea', {
required: true,
value: form.sc1,
onChange: (e) => setForm({...form, sc1: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'You catch a member using forbidden client modifications(hacks/cheats). What would you do?'),
React.createElement('textarea', {
required: true,
value: form.sc2,
onChange: (e) => setForm({...form, sc2: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'A member is being negative in in game chat, demanding redos, accusing everyone of cheating, and demanding the mods ban people. What would you do?'),
React.createElement('textarea', {
required: true,
value: form.sc3,
onChange: (e) => setForm({...form, sc3: e.target.value})
})
),
React.createElement('div', { className: 'form-group' },
React.createElement('label', null, 'You discover players exploiting a game-breaking bug. What would you do?'),
React.createElement('textarea', {
required: true,
value: form.sc4,
onChange: (e) => setForm({...form, sc4: e.target.value})
})
),
React.createElement('button', { type: 'submit' }, 'Submit Application')
),
status === 'success' && React.createElement('div', { className: 'success-message' },
'Your application has been submitted successfully!'
),
status === 'error' && React.createElement('div', { className: 'error-message' },
'There was an error submitting your application. Please try again later.'
)
)
);
};