├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .snyk
├── LICENSE
├── README.md
├── SECURITY.md
├── changelog.md
├── commands
├── hilfe.js
├── ticket.js
└── ticketteam.js
├── config.json
├── failsafe.js
├── lang
├── de_DE.json
└── en_EN.json
├── main.js
├── makeEmbed.js
├── package-lock.json
├── package.json
└── request.js
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help me improve my work
4 |
5 | ---
6 | **Which NodeJS version are you using? (type node -v in a command)**
7 | e.g. 12.0.0
8 |
9 | **Which version of ticketsystem are you using? (you can find the version in the package.json file)**
10 | e.g. 2.0.0
11 |
12 | **Describe the bug**
13 | A clear and precise description of what the bug is.
14 |
15 | **To Reproduce**
16 | Steps to reproduce the behavior:
17 | 1. Go to '...'
18 | 2. Enter '....'
19 | 3. Click on '....'
20 | 4. See error
21 |
22 | **Expected behavior**
23 | A clear and precise description of what you expected to happen.
24 |
25 | **Screenshots**
26 | If applicable, add screenshots to help explain your problem.
27 |
28 | **Additional context**
29 | Add any other context about the problem here.
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project to improve the bot
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | log
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Tickets
9 | tickets/
10 | tickets
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 |
24 | # nyc test coverage
25 | .nyc_output
26 |
27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
28 | .grunt
29 |
30 | # Bower dependency directory (https://bower.io/)
31 | bower_components
32 |
33 | # node-waf configuration
34 | .lock-wscript
35 |
36 | # Compiled binary addons (http://nodejs.org/api/addons.html)
37 | build/Release
38 |
39 | # Dependency directories
40 | node_modules/
41 | jspm_packages/
42 |
43 | # Typescript v1 declaration files
44 | typings/
45 |
46 | # Optional npm cache directory
47 | .npm
48 |
49 | # Optional eslint cache
50 | .eslintcache
51 |
52 | # Optional REPL history
53 | .node_repl_history
54 |
55 | # Output of 'npm pack'
56 | *.tgz
57 |
58 | # Yarn Integrity file
59 | .yarn-integrity
60 |
61 | # dotenv environment variables file
62 | .env
63 |
64 | log/
65 | .vs/stb/v15/.suo
66 | .vs/slnx.sqlite
67 | .vs/VSWorkspaceState.json
68 | .vs/slnx.sqlite
69 | .vs/slnx.sqlite
70 | .vs/ProjectSettings.json
71 | .vs/VSWorkspaceState.json
72 |
--------------------------------------------------------------------------------
/.snyk:
--------------------------------------------------------------------------------
1 | # Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
2 | version: v1.14.1
3 | ignore: {}
4 | patch: {}
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Discord Ticket System by AstroGD
2 | A ticket system for Discord to reach the users questions more easily and never loose a message in chat.
3 |
4 | Simply edit command names and language via language and config files.
5 |
6 | If you have any question feel free to contact me via mail to support@astrogd.eu or send a dm to AstroGD#3416
7 |
8 | ## Features
9 | Getting in touch with the team on a server with many members can be very difficult and frustrating. Your question or the teams answer might get lost in the chat and you need to scroll and search if you want to re-read the messages. Thats why the ticketsystem is for you!
10 | If you have questions you can start a ticket and the team will be notified about your issue. But there's more: You'll even get a DM from the bot if your case updates so that you also won't miss an update ever again.
11 |
12 | So what are are you waiting for? Download ticketsystem now and make reaching you and your team easier than ever before!
13 |
14 | ## Screenshots
15 | 
16 |
17 | _A ticket was created_
18 |
19 | 
20 |
21 | _A ticket has been answered_
22 |
23 | ## How to use
24 | - If you want to install this project go to [How to install](https://github.com/AstroGD/ticketsystem/wiki/How-to-install)
25 | - For help in setting up your config go to [Set up your config](https://github.com/AstroGD/ticketsystem/wiki/Set-up-your-config)
26 | - Looking for a list of all available commands? Go to [available commands](https://github.com/AstroGD/ticketsystem/wiki/Available-commands)
27 | - Still having an issue or a question? [Reach out to me](https://www.astrogd.eu/en/kontakt)
28 |
29 | ## I noticed a bug what can I do?
30 | - Please [create a bug report](https://github.com/AstroGD/ticketsystem/issues/new/choose) and tell me as precise as possible what happened, how to reproduce the bug and which Node version and version of the ticketsystem you are running
31 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | | Version | Supported |
6 | | ------- | ------------------ |
7 | | 2.0.x | :white_check_mark: |
8 | | < 2.0 | :x: |
9 |
10 | ## Reporting a Vulnerability
11 |
12 | Please contact me via security@astrogd.eu to report a security vulnerability.
13 |
Thank you in advance for contributing to the safety of code on github!
14 |
You can expect to hear back from me within 2 days
15 |
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | # Version 2.0.5
2 | #### Released on 10.04.2021
3 |
4 | ## Bugfixes
5 | :bug: Fixed a bug where the bot would crash if an invalid guild id was provided in the config
6 |
7 | ## Dependency Updates
8 | :arrow_up: Update discord.js to 12.5.3
9 | :arrow_up: Update follow-redirects to 1.13.3
10 |
11 | # Version 2.0.4
12 | #### Released on 03.02.2021
13 |
14 | ## Dependency updates
15 | :arrow_up: Update discord.js to 12.5.1
16 | :arrow_up: Update follow-redirects to 1.13.2
17 | :arrow_up: Update fs-extra to 9.1.0
18 |
19 | # Version 2.0.3
20 | #### Released 01.10.2020 (DMY)
21 |
22 | ## Bugfixes
23 | - :bug: Fixed a bug where no Notification is being sent after a user answers a ticket
24 | - :bug: Fixed a bug where /ticketteam would not send an error if a user has insufficient permissions
25 | - :bug: Fixed a bug where sending /ticketteam without an action would throw no error for authorized users
26 | - :bug: Fixed embed colour for error message if an user with insufficient permissions tries to use /ticketteam
27 |
28 | ## Dependency updates
29 | - :arrow_up: Upgraded dependencies to newest version
30 |
31 | ## Removed Features
32 | - :fire: Removed legacy check for me to be able to use /ticketteam without having the team-role
33 |
34 | ## Language
35 | - :globe_with_meridians: Fixed a typo for English language pack
36 |
37 | ## UI and Style
38 | - :lipstick: Log output regarding version checks are now colourized. If no update is available the output will be coloured green. If there is an update available or an error occurred while checking for a new version the output will be red.
39 |
40 | ## Documentation
41 | - :memo: Added Changelog
--------------------------------------------------------------------------------
/commands/hilfe.js:
--------------------------------------------------------------------------------
1 | module.exports = function (log, makeEmbed, language, config, languageconfig) {
2 | return function (message) {
3 | var embed = makeEmbed(message, "0094FF", `ℹ️ ${language.help}`, language.information_to_the_use_of_the_ticket_system, [{
4 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.create} <${language.message}>`,
5 | value: language.starts_a_new_ticket
6 | }, {
7 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.info} <${language.ticketid}>`,
8 | value: language.information_about_the_selected_ticket
9 | }, {
10 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.answer} <${language.ticketid}> <${language.message}>`,
11 | value: language.sends_an_answer_to_a_ticket
12 | }, {
13 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.close} <${language.ticketid}>`,
14 | value: language.closes_a_ticket
15 | }]);
16 | message.channel.send("", {
17 | embed: embed
18 | }).catch(e => {
19 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
20 | }).then(msg => {
21 | msg.delete({timeout:30000}).catch(e => {});
22 | });
23 |
24 | var guild = message.guild;
25 | var role = guild.roles.cache.get(config.team_role_id);
26 |
27 | if (!role) {
28 | log(`Teamroleid invalid. Please check the config.json`, 1);
29 | message.channel.send("", {
30 | embed: makeEmbed(message, "#00FF21", `❗ ${language.an_error_occurred}`, language.the_team_role_stored_in_the_bots_config_is_invalid_please_contact_an_administrator)
31 | })
32 | .catch(e => {
33 | log(`An error occured while sending a message to ${message.channel.name}: ${e.stack}`, 1);
34 | });
35 | return;
36 | }
37 |
38 | if (message.member.roles.cache.get(role.id)) {
39 | message.author.send("", {
40 | embed: makeEmbed(message, "#0094FF", `ℹ️ ${language.help}`, language.information_to_the_use_of_the_ticket_system + " | " + language.for_staff_members, [{
41 | title: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.info} <${language.ticketid}>`,
42 | value: language.information_about_the_selected_ticket
43 | }, {
44 | title: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.answer} <${language.ticketid}> <${language.message}>`,
45 | value: language.sends_an_answer_to_a_ticket
46 | }, {
47 | title: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.close} <${language.ticketid}>`,
48 | value: language.closes_a_ticket
49 | }, {
50 | title: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.reopen} <${language.ticketid}>`,
51 | value: language.reopens_a_ticket
52 | }, {
53 | title: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.list}`,
54 | value: language.shows_a_list_of_all_open_tickets
55 | }, {
56 | title: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.user} <${language.userid_or_mention}>`,
57 | value: language.shows_a_list_of_tickets_created_by_a_specific_user
58 | }])
59 | })
60 | .catch(e => {
61 | log(`An error occured while sending a message to ${message.author.tag}: ${e.stack}`, 1);
62 | });
63 | return;
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/commands/ticket.js:
--------------------------------------------------------------------------------
1 | module.exports = function (log, makeEmbed, language, config, languageconfig, client) {
2 | const fs = require("fs-extra");
3 | const path = require("path");
4 |
5 | return function (message) {
6 | switch (message.content.toLowerCase().split(" ")[1]) {
7 | case languageconfig.ticketcommand.create.toLowerCase():
8 | if (!message.content.split(" ").slice(2).join(" ")) {
9 | message.channel.send("", {
10 | embed: makeEmbed(message, "#FF0000", `⁉ ${language.oops}`, `${language.please_tell_us_what_happened}`, [{
11 | title: language.usage_of_this_command,
12 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.create} <${language.message}>`
13 | }])
14 | })
15 | .catch(e => {
16 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
17 | })
18 | .then(msg => {
19 | msg.delete({
20 | timeout: 10000
21 | })
22 | .catch(e => {});
23 | });
24 | return;
25 | }
26 | if (message.content.split(" ").slice(1).slice(1).join(" ").length > 800) {
27 | message.channel.send(`${language.your_original_message}:\n\n${message.content.split(" ").slice(1).slice(1).join(" ")}`, {
28 | embed: makeEmbed(message, "#FF0000", `❗ ${language.oops}`, `${language.your_message_is_too_long} :( - ${language.a_maximum_of_800_characters_is_allowed}`)
29 | })
30 | .catch(e => {
31 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
32 | })
33 | .then(msg => {
34 | msg.delete({
35 | timeout: 20000
36 | })
37 | .catch(e => {});
38 | });
39 | return;
40 | }
41 | var ticket = {};
42 | ticket.author = message.author.id;
43 | ticket.avatarURL = message.author.avatarURL();
44 | ticket.created = new Date();
45 | if (message.attachments.array().length > 0) {
46 | message.channel.send(`${language.your_original_message}:\n\n${message.content.split(" ").slice(1).slice(1).join(" ")}`, {
47 | embed: makeEmbed(message, "#FF0000", `❗ ${language.oops}`, language.uploaded_images_cant_be_processed_please_send_them_as_a_link_in_the_text)
48 | })
49 | .catch(e => {
50 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
51 | })
52 | .then(msg => {
53 | msg.delete({
54 | timeout: 20000
55 | })
56 | .catch(e => {});
57 | });
58 | return;
59 | }
60 | ticket.finished = false;
61 | ticket.session = [{
62 | author: client.user.id,
63 | stamp: new Date(),
64 | avatar: client.user.avatarURL(),
65 | message: language.ticket_started
66 | }, {
67 | author: message.author.id,
68 | stamp: new Date(),
69 | avatar: message.author.avatarURL(),
70 | message: message.content.split(" ").slice(1).slice(1).join(" ")
71 | }];
72 | ticket.id = `T-${message.author.id}-${new Date().getFullYear()}-${new Date().getMonth()}-${new Date().getDate()}-${new Date().getHours()}-${new Date().getMinutes()}-${new Date().getSeconds()}`;
73 | var embed = makeEmbed(message, "#00FF21", `✅ ${language.finished}`, `${language.your_ticket_was_successfully_created_it_has_the_following_id}\n${ticket.id}\n${language.to_access_your_ticket_please_use_this_id}`, [{
74 | title: `${language.your_message}:`,
75 | value: ticket.session[1].message
76 | }])
77 | message.author.send(`${language.your_ticket_id}: ${ticket.id}`, {
78 | embed: embed
79 | })
80 | .catch(e => {
81 | log(`An error occurred while sending a message to ${message.author.tag}: ${e.stack}`, 2);
82 | message.channel.send(`${language.your_original_message}:\n\n${message.content.split(" ").slice(1).slice(1).join(" ")}`, makeEmbed(message, "#FF0000", `❗ ${language.oops}`, language.it_seems_youve_disabled_direct_messaging_please_activate_these_via_the_data_protection_settings_of_the_server))
83 | .catch(e => {
84 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
85 | })
86 | .then(msg => {
87 | msg.delete({
88 | timeout: 10000
89 | })
90 | .catch(e => {});
91 | });
92 | return;
93 | }).then(msg => {
94 | try {
95 | fs.writeFileSync(path.join(__dirname, `../tickets/${ticket.id}.ticket`), JSON.stringify(ticket));
96 | } catch (e) {
97 | log(`An error occurred while trying to save a ticket: ${e.stack}`, 1);
98 | return;
99 | }
100 | var teamchannel = message.guild.channels.cache.get(config.ticket_notification_channel_id);
101 | if (!teamchannel) {
102 | return;
103 | }
104 | var embed = makeEmbed(message, "#0094FF", `📨 ${language.new_ticket}`, ticket.id, [{
105 | title: language.author,
106 | value: ticket.author
107 | }, {
108 | title: language.created,
109 | value: ticket.created
110 | }, {
111 | empty: true
112 | }]);
113 | embed.setThumbnail(ticket.avatarURL);
114 | teamchannel.send(`${language.ticketid}: ${ticket.id}`, {
115 | embed: embed
116 | })
117 | .catch(e => {
118 | log(`An error occurred while sending a message to ${teamchannel.name}: ${e.stack}`, 1);
119 | })
120 | var user = client.users.cache.get(ticket.session[1].author)
121 | if (!user) {
122 | user = language.unknown_user;
123 | } else {
124 | user = user.username;
125 | }
126 | var embed = makeEmbed(message, "#0094FF", language.message_history, ticket.id, [{
127 | title: `${client.user.username} | ${ticket.session[0].stamp}`,
128 | value: ticket.session[0].message
129 | }, {
130 | title: `${user} | ${ticket.session[1].stamp}`,
131 | value: ticket.session[1].message
132 | }]);
133 | teamchannel.send("", {
134 | embed: embed
135 | })
136 | .catch(e => {
137 | log(`An error occurred while sending a message to ${teamchannel.name}: ${e.stack}`, 1);
138 | })
139 | });
140 | break;
141 | case languageconfig.ticketcommand.info.toLowerCase():
142 | if (!message.content.split(" ").slice(1).slice(1).join(" ")) {
143 | message.channel.send("", {
144 | embed: makeEmbed(message, "FF0000", `⁉️ ${language.oops}`, language.please_enter_a_ticketid, [{
145 | title: language.usage_of_this_command,
146 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.info} <${language.ticketid}>`
147 | }])
148 | })
149 | .catch(e => {
150 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
151 | })
152 | .then(msg => {
153 | msg.delete({
154 | timeout: 10000
155 | })
156 | .catch(e => {});
157 | });
158 | return;
159 | }
160 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
161 | var ticket = tickets.filter(function (element) {
162 | return (element === `${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket` || element === `STOP-${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket`);
163 | });
164 | if (!ticket || ticket.length === 0) {
165 | message.channel.send("", {
166 | embed: makeEmbed(message, "FF0000", `⁉️ ${language.oops}`, language.unknown_ticket_id, [{
167 | title: language.usage_of_this_command,
168 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.info} <${language.ticketid}>`
169 | }])
170 | })
171 | .catch(e => {
172 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
173 | })
174 | .then(msg => {
175 | msg.delete({
176 | timeout: 10000
177 | })
178 | .catch(e => {});
179 | });
180 | return;
181 | }
182 | ticket = ticket[0];
183 | var ticketfile = ticket;
184 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticket}`)));
185 | if (ticket.finished) {
186 | message.channel.send("", {
187 | embed: makeEmbed(message, "FF0000", `🚫 ${language.ticket_closed}`, language.your_tickets_been_closed_please_contact_the_team_if_this_is_a_mistake)
188 | })
189 | .catch(e => {
190 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
191 | })
192 | .then(msg => {
193 | msg.delete({
194 | timeout: 10000
195 | })
196 | .catch(e => {});
197 | });
198 | return;
199 | }
200 | if (ticket.author != message.author.id) {
201 | message.channel.send("", {
202 | embed: makeEmbed(message, "FF0000", `🚫 ${language.oops}`, language.this_ticket_was_not_created_by_you)
203 | })
204 | .catch(e => {
205 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
206 | })
207 | .then(msg => {
208 | msg.delete({
209 | timeout: 10000
210 | })
211 | .catch(e => {});
212 | });
213 | return;
214 | }
215 | var embed = makeEmbed(message, '#0094FF', `ℹ️ ${language.information_about_the_selected_ticket}`, ticket.id, [{
216 | empty: true
217 | }, {
218 | title: language.created,
219 | value: ticket.created
220 | }, {
221 | title: language.message,
222 | value: ticket.session[1].message
223 | }]);
224 | message.author.send(`${language.your_ticket_id}: ${ticket.id}`, {
225 | embed: embed
226 | })
227 | .catch(e => {
228 | log(`An error occured while sending a message to ${message.author.tag}: ${e.stack}`, 2);
229 | message.channel.send("", {
230 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.it_seems_youve_disabled_direct_messaging_please_activate_these_via_the_data_protection_settings_of_the_server)
231 | })
232 | .catch(e => {
233 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
234 | })
235 | .then(msg => {
236 | msg.delete({
237 | timeout: 10000
238 | })
239 | .catch(e => {});
240 | });
241 | return;
242 | });
243 | var embed2 = makeEmbed(message, "#0094FF", language.message_history, language.displays_the_last_10_messages_and_the_original_request);
244 | var j = 0;
245 | for (var i = ticket.session.length - 1; i >= 0 && j <= 10; i--) {
246 | var user = message.guild.members.cache.get(ticket.session[i].author);
247 | if (!user) {
248 | user = language.unknown_user;
249 | } else {
250 | user = user.user.username + "#" + user.user.discriminator;
251 | }
252 | var stamp = new Date(ticket.session[i].stamp)
253 | stamp = `${stamp.getDate()}.${stamp.getMonth() + 1}.${stamp.getFullYear()} ${language.at} ${stamp.toString()}`;
254 | embed2.addField(`${user} ${language.at} ${stamp}`, ticket.session[i].message);
255 | j++;
256 | }
257 | message.author.send("", {
258 | embed: embed2
259 | })
260 | .catch(e => {
261 | log(`An error occurred while sending a message to ${message.author.tag}: ${e.stack}`, 1);
262 | return;
263 | });
264 | break;
265 | case languageconfig.ticketcommand.answer.toLowerCase():
266 | if (!message.content.split(" ")[2]) {
267 | message.channel.send("", {
268 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
269 | title: language.usage_of_this_command,
270 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.answer} <${language.ticketid}> <${language.message}>`
271 | }])
272 | })
273 | .catch(e => {
274 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
275 | })
276 | .then(msg => {
277 | msg.delete({
278 | timeout: 10000
279 | })
280 | .catch(e => {});
281 | });
282 | return;
283 | } else if (!message.content.split(" ").slice(3).join(" ")) {
284 | message.channel.send("", {
285 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_message, [{
286 | title: language.usage_of_this_command,
287 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.answer} <${language.ticketid}> <${language.message}>`
288 | }])
289 | })
290 | .catch(e => {
291 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
292 | })
293 | .then(msg => {
294 | msg.delete({
295 | timeout: 10000
296 | })
297 | .catch(e => {});
298 | });
299 | return;
300 | }
301 | if (message.content.split(" ").slice(3).join(" ").length > 800) {
302 | message.channel.send(`${language.your_original_message}:\n\n${message.content.split(" ").slice(3).join(" ")}`, {
303 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.a_maximum_of_800_characters_is_allowed)
304 | })
305 | .catch(e => {
306 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
307 | })
308 | .then(msg => {
309 | msg.delete({
310 | timeout: 20000
311 | })
312 | .catch(e => {});
313 | });
314 | return;
315 | }
316 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
317 | var ticket = tickets.filter(function (element) {
318 | return (element === `${message.content.split(" ")[2]}.ticket` || element === `STOP-${message.content.split(" ")[2]}.ticket`);
319 | });
320 | if (ticket.length <= 0) {
321 | message.channel.send("", {
322 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_ticket_id, [{
323 | title: language.usage_of_this_command,
324 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.answer} <${language.ticketid}> <${language.message}>`
325 | }])
326 | })
327 | .catch(e => {
328 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
329 | })
330 | .then(msg => {
331 | msg.delete({
332 | timeout: 10000
333 | })
334 | .catch(e => {});
335 | });
336 | return;
337 | }
338 | var ticketfile = ticket[0];
339 | ticket = ticket[0];
340 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticket}`)));
341 | if (ticket.author != message.author.id) {
342 | message.channel.send("", {
343 | embed: makeEmbed(message, "FF0000", `🚫 ${language.oops}`, language.this_ticket_was_not_created_by_you)
344 | })
345 | .catch(e => {
346 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
347 | })
348 | .then(msg => {
349 | msg.delete({
350 | timeout: 10000
351 | })
352 | .catch(e => {});
353 | });
354 | return;
355 | }
356 | if (ticket.finished) {
357 | message.channel.send("", {
358 | embed: makeEmbed(message, "FF0000", `🚫 ${language.ticket_closed}`, language.your_tickets_been_closed_please_contact_the_team_if_this_is_a_mistake)
359 | })
360 | .catch(e => {
361 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
362 | })
363 | .then(msg => {
364 | msg.delete({
365 | timeout: 10000
366 | })
367 | .catch(e => {});
368 | });
369 | return;
370 | }
371 | var msg = message.content.split(" ").slice(3).join(" ");
372 | if (message.attachments.array().length > 0) {
373 | message.channel.send("", {
374 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.uploaded_images_cant_be_processed_please_send_them_as_a_link_in_the_text)
375 | })
376 | .catch(e => {
377 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
378 | })
379 | .then(msg => {
380 | msg.delete({
381 | timeout: 10000
382 | })
383 | .catch(e => {});
384 | });
385 | }
386 | ticket.session.push({
387 | author: message.author.id,
388 | stamp: new Date(),
389 | avatar: message.author.avatarURL(),
390 | message: msg
391 | });
392 | try {
393 | fs.writeFileSync(path.join(__dirname, `../tickets/${ticketfile}`), JSON.stringify(ticket));
394 | } catch (e) {
395 | log(`An error occurred while saving the ticket ${ticketfile}: ${e.message}`, 1);
396 | message.channel.send("", {
397 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.an_error_occurred, [{
398 | title: language.error,
399 | value: e.message
400 | }])
401 | })
402 | .catch(e => {
403 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
404 | })
405 | .then(msg => {
406 | msg.delete({
407 | timeout: 10000
408 | })
409 | .catch(e => {});
410 | });
411 | return;
412 | }
413 | message.channel.send("", {
414 | embed: makeEmbed(message, "00FF21", `✅ ${language.finished}`, language.your_message_has_been_sent)
415 | })
416 | .catch(e => {
417 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
418 | })
419 | .then(msg => {
420 | msg.delete({
421 | timeout: 10000
422 | })
423 | .catch(e => {});
424 | });
425 | message.author.send(`${language.your_ticket_id}: ${ticket.id}`, {
426 | embed: makeEmbed(message, "0094FF", `📨 ${language.you_replied_to_your_ticket}`, `${language.message}: ${msg}`)
427 | })
428 | .catch(e => {
429 | log(`An error occurred while sending a messagee to ${message.author.tag}: ${e.stack}`, 2);
430 | });
431 | var teamchannel = client.guilds.cache.get(config.server_id).channels.cache.get(config.ticket_notification_channel_id);
432 | if (!teamchannel) {
433 | return;
434 | }
435 | teamchannel.send(`${language.ticketid}: ${ticket.id}`, {
436 | embed: makeEmbed(message, "0094FF", `📨 ${language.new_message}`, `${language.there_is_a_new_answer_for_the_ticket} ${ticket.id}`, [{
437 | title: language.message,
438 | value: msg
439 | }])
440 | })
441 | .catch(e => {
442 | log(`An error occured while sending a message to ${teamchannel.name}: ${e.stack}`, 1);
443 | });
444 | break;
445 | case languageconfig.ticketcommand.close.toLowerCase():
446 | if (!message.content.split(" ").slice(1).slice(1).join(" ")) {
447 | message.channel.send("", {
448 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
449 | title: language.usage_of_this_command,
450 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.close} <${language.ticketid}>`
451 | }])
452 | })
453 | .catch(e => {
454 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
455 | })
456 | .then(msg => {
457 | msg.delete({
458 | timeout: 10000
459 | })
460 | .catch(e => {});
461 | });
462 | return;
463 | }
464 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
465 | var ticket = tickets.filter(function (element) {
466 | return (element === `${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket` || element === `STOP-${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket`);
467 | });
468 | if (ticket.length <= 0) {
469 | message.channel.send("", {
470 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_ticket_id, [{
471 | title: language.usage_of_this_command,
472 | value: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.close} <${language.ticketid}>`
473 | }])
474 | })
475 | .catch(e => {
476 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
477 | })
478 | .then(msg => {
479 | msg.delete({
480 | timeout: 10000
481 | })
482 | .catch(e => {});
483 | });
484 | return;
485 | }
486 | var ticketfile = ticket[0];
487 | ticket = ticket[0];
488 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticketfile}`)));
489 | if (ticket.author != message.author.id) {
490 | message.channel.send("", {
491 | embed: makeEmbed(message, "FF0000", `🚫 ${language.oops}`, language.this_ticket_was_not_created_by_you)
492 | })
493 | .catch(e => {
494 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
495 | })
496 | .then(msg => {
497 | msg.delete({
498 | timeout: 10000
499 | })
500 | .catch(e => {});
501 | });
502 | return;
503 | }
504 | if (ticket.finished) {
505 | message.channel.send("", {
506 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.the_ticket_has_already_been_closed)
507 | })
508 | .catch(e => {
509 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
510 | })
511 | .then(msg => {
512 | msg.delete({
513 | timeout: 10000
514 | })
515 | .catch(e => {});
516 | });
517 | return;
518 | }
519 | ticket.finished = true;
520 | var msg = language.the_ticket_was_closed_by_the_user;
521 | ticket.session.push({
522 | author: client.user.id,
523 | stamp: new Date(),
524 | avatar: client.user.avatarURL(),
525 | message: msg
526 | });
527 | try {
528 | fs.writeFileSync(path.join(__dirname, `../tickets/${ticketfile}`), JSON.stringify(ticket));
529 | } catch (e) {
530 | log(`An error occurred while saving ticket ${ticketfile}: ${e.stack}`, 1);
531 | message.channel.send("", {
532 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.an_error_occurred, [{
533 | title: language.error,
534 | value: e.message
535 | }])
536 | })
537 | .catch(e => {
538 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
539 | })
540 | .then(msg => {
541 | msg.delete({
542 | timeout: 10000
543 | })
544 | .catch(e => {});
545 | });
546 | return;
547 | }
548 | fs.renameSync(path.join(__dirname, `../tickets/${ticketfile}`), path.join(__dirname, `../tickets/STOP-${ticketfile}`));
549 | message.channel.send("", {
550 | embed: makeEmbed(message, "00FF21", `✅ ${language.finished}`, language.your_ticket_has_been_closed)
551 | })
552 | .catch(e => {
553 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
554 | })
555 | .then(msg => {
556 | msg.delete({
557 | timeout: 10000
558 | })
559 | .catch(e => {});
560 | });
561 | var teamchannel = client.guilds.cache.get(config.server_id).channels.cache.get(config.ticket_notification_channel_id);
562 | if (!teamchannel) {
563 | return;
564 | }
565 | teamchannel.send(`${language.ticketid}: ${ticket.id}`, {
566 | embed: makeEmbed(message, "0094FF", `🚫 ${language.ticket_closed}`, language.the_following_ticket_has_been_closed + ": " + ticket.id)
567 | })
568 | .catch(e => {
569 | log(`An error occurred while sending a message to ${teamchannel.name}: ${e.stack}`, 1);
570 | });
571 | break;
572 | default:
573 | message.channel.send("", {
574 | embed: makeEmbed(message, "#0094FF", `ℹ️ ${language.usage_of_this_command}`, `${language.help_for} ${config.prefix}ticket`, [{
575 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.create} <${language.message}>`,
576 | value: language.starts_a_new_ticket
577 | }, {
578 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.info} <${language.ticketid}>`,
579 | value: language.sends_information_about_a_ticket
580 | }, {
581 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.answer} <${language.ticketid}> <${language.message}>`,
582 | value: language.sends_an_answer_to_a_ticket
583 | }, {
584 | title: `${config.prefix}${languageconfig.ticketcommand.main} ${languageconfig.ticketcommand.close} <${language.ticketid}>`,
585 | value: language.closes_a_ticket
586 | }])
587 | })
588 | .catch(e => {
589 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
590 | })
591 | .then(msg => {
592 | msg.delete({
593 | timeout: 20000
594 | })
595 | .catch(e => {});
596 | });
597 | break;
598 | }
599 | }
600 | }
--------------------------------------------------------------------------------
/commands/ticketteam.js:
--------------------------------------------------------------------------------
1 | module.exports = function (log, makeEmbed, language, config, languageconfig, client) {
2 | const fs = require("fs-extra");
3 | const path = require("path");
4 | return async function (message) {
5 | var guild = message.guild;
6 | var role = guild.roles.cache.get(config.team_role_id);
7 |
8 | if (!role) {
9 | log(`Teamroleid invalid. Please check the config.json`, 1);
10 | message.channel.send("", {
11 | embed: makeEmbed(message, "#00FF21", `❗ ${language.an_error_occurred}`, language.the_team_role_stored_in_the_bots_config_is_invalid_please_contact_an_administrator)
12 | })
13 | .catch(e => {
14 | log(`An error occured while sending a message to ${message.channel.name}: ${e.stack}`, 1);
15 | })
16 | .then(msg => {
17 | msg.delete({
18 | timeout: 10000
19 | }).catch(e => {});
20 | });
21 | return;
22 | }
23 |
24 | if (!message.member.roles.cache.get(role.id)) {
25 | message.channel.send("", {
26 | embed: makeEmbed(message, "#FF0000", `❗ ${language.oops}`, language.you_do_not_have_the_required_authorization_to_use_this_command)
27 | })
28 | .catch(e => {
29 | log(`An error occured while sending a message to ${message.channel.name}: ${e.stack}`, 1);
30 | })
31 | .then(msg => {
32 | msg.delete({
33 | timeout: 10000
34 | }).catch(e => {});
35 | });
36 | return;
37 | }
38 |
39 | if (!message.content.split(" ")[1]) {
40 | message.channel.send("", {
41 | embed: makeEmbed(message, "#FF0000", `❗ ${language.oops}`, language.please_enter_an_action, [{
42 | title: language.you_have_the_following_options,
43 | value: `${languageconfig.ticketteamcommand.info}, ${languageconfig.ticketteamcommand.answer}, ${languageconfig.ticketteamcommand.close}, ${languageconfig.ticketteamcommand.reopen}, ${languageconfig.ticketteamcommand.list}, ${languageconfig.ticketteamcommand.user}`
44 | }])
45 | })
46 | .catch(e => {
47 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
48 | return;
49 | })
50 | .then(msg => {
51 | msg.delete({
52 | timeout: 10000
53 | })
54 | .catch(e => {});
55 | });
56 | return;
57 | }
58 |
59 | switch (message.content.split(" ")[1].toLowerCase()) {
60 | case languageconfig.ticketteamcommand.info.toLowerCase():
61 | if (!message.content.split(" ").slice(1).slice(1).join(" ")) {
62 | message.channel.send("", {
63 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
64 | title: language.usage_of_this_command,
65 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.info} <${language.ticketid}>`
66 | }])
67 | })
68 | .catch(e => {
69 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
70 | })
71 | .then(msg => {
72 | msg.delete({
73 | timeout: 10000
74 | })
75 | .catch(e => {});
76 | });
77 | return;
78 | }
79 | var tickets = fs.readdirSync(path.join(__dirname, "../tickets/"));
80 | var ticket = tickets.filter(function (element) {
81 | return (element === `${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket` || element === `STOP-${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket`);
82 | });
83 | if (!ticket || ticket.length === 0) {
84 | message.channel.send("", {
85 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_ticket_id, [{
86 | title: language.usage_of_this_command,
87 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.info} <${language.ticketid}>`
88 | }])
89 | })
90 | .catch(e => {
91 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
92 | })
93 | .then(msg => {
94 | msg.delete({
95 | timeout: 10000
96 | })
97 | .catch(e => {});
98 | });
99 | return;
100 | }
101 | var ticketfile = ticket[0];
102 | ticket = ticket[0];
103 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticketfile}`)));
104 | var premsg = "";
105 | if (ticket.finished) {
106 | premsg = `**${language.attention}** ${language.the_ticket_has_already_been_closed}\n${language.ticketid}: ${ticket.id}`;
107 | } else {
108 | premsg = `${language.ticketid}: ${ticket.id}`;
109 | }
110 | var embed = makeEmbed(message, '#0094FF', `ℹ️ ${language.information_about_the_selected_ticket}`, ticket.id, [{
111 | empty: true
112 | }, {
113 | title: language.created,
114 | value: ticket.created
115 | }, {
116 | title: language.message,
117 | value: ticket.session[1].message
118 | }]);
119 | message.channel.send(premsg, {
120 | embed: embed
121 | })
122 | .catch(e => {
123 | return;
124 | });
125 | var embed2 = makeEmbed(message, "#0094FF", language.message_history, language.displays_the_last_10_messages_and_the_original_request);
126 | var j = 0;
127 | var guild = message.guild;
128 | for (var i = ticket.session.length - 1; i >= 0 && j <= 10; i--) {
129 | var user = guild.members.cache.get(ticket.session[i].author);
130 | if (!user) {
131 | user = language.unknown_user;
132 | } else {
133 | user = user.user.username + "#" + user.user.discriminator;
134 | }
135 | var stamp = new Date(ticket.session[i].stamp)
136 | stamp = `${stamp.getDate()}.${stamp.getMonth() + 1}.${stamp.getFullYear()} ${language.at} ${stamp.toString()}`;
137 | embed2.addField(`${user} ${language.at} ${stamp}`, ticket.session[i].message);
138 | j++;
139 | }
140 | message.channel.send("", {
141 | embed: embed2
142 | })
143 | .catch(e => {
144 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
145 | return;
146 | });
147 | break;
148 | case languageconfig.ticketteamcommand.answer.toLowerCase():
149 | if (!message.content.split(" ")[2]) {
150 | message.channel.send("", {
151 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
152 | title: language.usage_of_this_command,
153 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.answer} <${language.ticketid}> <${language.message}>`
154 | }])
155 | })
156 | .catch(e => {
157 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
158 | })
159 | .then(msg => {
160 | msg.delete({
161 | timeout: 10000
162 | })
163 | .catch(e => {});
164 | });
165 | return;
166 | } else if (!message.content.split(" ").slice(3).join(" ")) {
167 | message.channel.send("", {
168 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_message, [{
169 | title: language.usage_of_this_command,
170 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.answer} <${language.ticketid}> <${language.message}>`
171 | }])
172 | })
173 | .catch(e => {
174 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
175 | })
176 | .then(msg => {
177 | msg.delete({
178 | timeout: 10000
179 | })
180 | .catch(e => {});
181 | });
182 | return;
183 | }
184 | if (message.content.split(" ").slice(3).join(" ").length > 800) {
185 | message.channel.send(`${language.your_original_message}:\n\n${message.content.split(" ").slice(3).join(" ")}`, {
186 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.a_maximum_of_800_characters_is_allowed)
187 | })
188 | .catch(e => {
189 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
190 | })
191 | .then(msg => {
192 | msg.delete({
193 | timeout: 10000
194 | })
195 | .catch(e => {});
196 | });
197 | return;
198 | }
199 | var tickets = fs.readdirSync(path.join(__dirname, "../tickets/"));
200 | var ticket = tickets.filter(function (element) {
201 | return (element === `${message.content.split(" ")[2]}.ticket` || element === `STOP-${message.content.split(" ")[2]}.ticket`);
202 | });
203 | if (ticket.length <= 0) {
204 | message.channel.send("", {
205 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_ticket_id, [{
206 | title: language.usage_of_this_command,
207 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.answer} <${language.ticketid}> <${language.message}>`
208 | }])
209 | })
210 | .catch(e => {
211 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
212 | })
213 | .then(msg => {
214 | msg.delete({
215 | timeout: 10000
216 | })
217 | .catch(e => {});
218 | });
219 | return;
220 | }
221 | var ticketfile = ticket[0];
222 | ticket = ticket[0];
223 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticketfile}`)));
224 | if (ticket.finished) {
225 | message.channel.send("", {
226 | embed: makeEmbed(message, "FF0000", `🚫 ${language.ticket_closed}`, language.you_can_no_longer_reply_to_this_ticket)
227 | })
228 | .catch(e => {
229 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
230 | })
231 | .then(msg => {
232 | msg.delete({
233 | timeout: 10000
234 | })
235 | .catch(e => {});
236 | });
237 | return;
238 | }
239 | var msg = message.content.split(" ").slice(3).join(" ");
240 | if (message.attachments.array().length > 0) {
241 | message.channel.send("", {
242 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.uploaded_images_cant_be_processed_please_send_them_as_a_link_in_the_text)
243 | })
244 | .catch(e => {
245 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
246 | })
247 | .then(msg => {
248 | msg.delete({
249 | timeout: 10000
250 | })
251 | .catch(e => {});
252 | });
253 | }
254 | ticket.session.push({
255 | author: message.author.id,
256 | stamp: new Date(),
257 | avatar: message.author.avatarURL(),
258 | message: msg
259 | });
260 | try {
261 | fs.writeFileSync(path.join(__dirname, `../tickets/${ticketfile}`), JSON.stringify(ticket));
262 | } catch (e) {
263 | log(`An error occurred while saving ticketfile ${ticketfile}: ${e.stack}`, 1);
264 | message.channel.send("", {
265 | embed: makeEmbed(message, "FF0000", `❗ ${language.error}`, language.an_error_occurred, [{
266 | title: language.error,
267 | value: e.message
268 | }])
269 | })
270 | .catch(e => {
271 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
272 | })
273 | .then(msg => {
274 | msg.delete({
275 | timeout: 10000
276 | })
277 | .catch(e => {});
278 | });
279 | return;
280 | }
281 | message.channel.send("", {
282 | embed: makeEmbed(message, "00FF21", `✅ ${language.finished}`, language.your_message_has_been_sent)
283 | })
284 | .catch(e => {
285 | log(`An error occured while sending a message to ${message.channel.name}: ${e.stack}`, 1);
286 | })
287 | .then(msg => {
288 | msg.delete({
289 | timeout: 10000
290 | })
291 | .catch(e => {});
292 | });
293 | var user = client.users.cache.get(ticket.author);
294 | if (!user) {
295 | message.channel.send("", {
296 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_user)
297 | })
298 | .catch(e => {
299 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
300 | })
301 | .then(msg => {
302 | msg.delete({
303 | timeout: 10000
304 | })
305 | .catch(e => {});
306 | });
307 | return;
308 | }
309 | var channel = message.guild.channels.cache.get(config.ticket_notification_channel_id);
310 | if (channel) {
311 | channel.send(`${language.ticketid}: ${ticket.id}`, {
312 | embed: makeEmbed(message, "0094FF", `📨 ${message.author.username}#${message.author.discriminator} ${language.responded_to_the_ticket}: ${ticket.id}`, `${language.message}: ${msg}`)
313 | })
314 | .catch(e => {
315 | log(`An error occurred while sending a message to ${channel.name}: ${e.stack}`, 1);
316 | });
317 | }
318 | user.send(`${language.your_ticket_id}: ${ticket.id}`, {
319 | embed: makeEmbed(message, "0094FF", `📨 ${language.new_message}`, language.there_is_a_new_answer_for_the_ticket, [{
320 | title: language.message,
321 | value: msg
322 | }, {
323 | title: language.do_you_need_more_information_about_your_ticket,
324 | value: `${language.use} ${config.prefix}ticket info ${ticket.id} ${language.for_more_details_about_your_ticket}`
325 | }])
326 | })
327 | .catch(e => {
328 | log(`An error occurred while sending a message to ${user.tag}: ${e.stack}`, 1);
329 | });
330 | break;
331 | case languageconfig.ticketteamcommand.close.toLowerCase():
332 | if (!message.content.split(" ").slice(1).slice(1).join(" ")) {
333 | message.channel.send("", {
334 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
335 | title: language.usage_of_this_command,
336 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.close} <${language.ticketid}>`
337 | }])
338 | })
339 | .catch(e => {
340 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
341 | })
342 | .then(msg => {
343 | msg.delete({
344 | timeout: 10000
345 | })
346 | .catch(e => {});
347 | });
348 | return;
349 | }
350 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
351 | var ticket = tickets.filter(function (element) {
352 | return (element === `${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket` || element === `STOP-${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket`);
353 | });
354 | if (ticket.length <= 0) {
355 | message.channel.send("", {
356 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_ticket_id, [{
357 | title: language.usage_of_this_command,
358 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.close} <${language.ticketid}>`
359 | }])
360 | })
361 | .catch(e => {
362 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
363 | })
364 | .then(msg => {
365 | msg.delete({
366 | timeout: 10000
367 | })
368 | .catch(e => {});
369 | });
370 | return;
371 | }
372 | var ticketfile = ticket[0];
373 | ticket = ticket[0];
374 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticketfile}`)));
375 | if (ticket.finished) {
376 | message.channel.send("", {
377 | embed: makeEmbed(message, "FF0000", `🚫 ${language.oops}`, language.the_ticket_has_already_been_closed)
378 | })
379 | .catch(e => {
380 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`)
381 | })
382 | .then(msg => {
383 | msg.delete({
384 | timeout: 10000
385 | })
386 | .catch(e => {});
387 | });
388 | return;
389 | }
390 | ticket.finished = true;
391 | var msg = language.the_ticket_was_closed_by_a_staff_member;
392 | ticket.session.push({
393 | author: client.user.id,
394 | stamp: new Date(),
395 | avatar: client.user.avatarURL(),
396 | message: msg
397 | });
398 | try {
399 | fs.writeFileSync(path.join(__dirname, `../tickets/${ticketfile}`), JSON.stringify(ticket));
400 | } catch (e) {
401 | log(`An error occurred while saving ticket ${ticketfile}: ${e.stack}`);
402 | message.channel.send("", {
403 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.an_error_occurred, [{
404 | title: language.error,
405 | value: e.message
406 | }])
407 | })
408 | .catch(e => {
409 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
410 | })
411 | .then(msg => {
412 | msg.delete({
413 | timeout: 10000
414 | })
415 | .catch(e => {});
416 | });
417 | return;
418 | }
419 | fs.renameSync(path.join(__dirname, `../tickets/${ticketfile}`), path.join(__dirname, `../tickets/STOP-${ticketfile}`));
420 | message.channel.send("", {
421 | embed: makeEmbed(message, "00FF21", `✅ ${language.finished}`, language.the_ticket_has_been_closed)
422 | })
423 | .catch(e => {
424 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
425 | })
426 | .then(msg => {
427 | msg.delete({
428 | timeout: 10000
429 | })
430 | .catch(e => {});
431 | });
432 | var user = client.users.cache.get(ticket.author);
433 | if (!user) {
434 | message.channel.send("", {
435 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_user)
436 | })
437 | .catch(e => {
438 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
439 | })
440 | .then(msg => {
441 | msg.delete({
442 | timeout: 10000
443 | })
444 | .catch(e => {});
445 | });
446 | return;
447 | }
448 | user.send(`${language.your_ticket_id}: ${ticket.id}`, {
449 | embed: makeEmbed(message, "0094FF", `✅ ${language.your_ticket_has_been_closed}`, `${language.ticketid}: ${ticket.id}`)
450 | })
451 | .catch(e => {
452 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
453 | });
454 | break;
455 | case languageconfig.ticketteamcommand.reopen.toLowerCase():
456 | if (!message.content.split(" ").slice(1).slice(1).join(" ")) {
457 | message.channel.send("", {
458 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
459 | title: language.usage_of_this_command,
460 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.reopen} <${language.ticketid}>`
461 | }])
462 | })
463 | .catch(e => {
464 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
465 | })
466 | .then(msg => {
467 | msg.delete({
468 | timeout: 10000
469 | })
470 | .catch(e => {});
471 | });
472 | return;
473 | }
474 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
475 | var ticket = tickets.filter(function (element) {
476 | return (element === `${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket` || element === `STOP-${message.content.split(" ").slice(1).slice(1).join(" ")}.ticket`);
477 | });
478 | if (ticket.length <= 0) {
479 | message.channel.send("", {
480 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_ticket_id, [{
481 | title: language.usage_of_this_command,
482 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.reopen} <${language.ticketid}>`
483 | }])
484 | })
485 | .catch(e => {
486 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
487 | })
488 | .then(msg => {
489 | msg.delete({
490 | timeout: 10000
491 | })
492 | .catch(e => {});
493 | });
494 | return;
495 | }
496 | var ticketfile = ticket[0];
497 | ticket = ticket[0];
498 | ticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${ticketfile}`)));
499 | if (!ticket.finished) {
500 | message.channel.send("", {
501 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.the_ticket_is_already_open)
502 | })
503 | .catch(e => {
504 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
505 | })
506 | .then(msg => {
507 | msg.delete({
508 | timeout: 10000
509 | })
510 | .catch(e => {});
511 | });
512 | return;
513 | }
514 | ticket.finished = false;
515 | var msg = language.the_ticket_has_been_opened_by_a_staff_member;
516 | ticket.session.push({
517 | author: client.user.id,
518 | stamp: new Date(),
519 | avatar: client.user.avatarURL(),
520 | message: msg
521 | });
522 | try {
523 | fs.writeFileSync(path.join(__dirname, `../tickets/${ticketfile}`), JSON.stringify(ticket));
524 | } catch (e) {
525 | log(`An error occurred while saving ticket ${ticketfile}: ${e.stack}`, 1);
526 | message.channel.send("", {
527 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.an_error_occurred, [{
528 | title: language.error,
529 | value: e.message
530 | }])
531 | })
532 | .catch(e => {
533 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
534 | })
535 | .then(msg => {
536 | msg.delete({
537 | timeout: 10000
538 | })
539 | .catch(e => {});
540 | });
541 | return;
542 | }
543 | fs.renameSync(path.join(__dirname, `../tickets/${ticketfile}`), path.join(__dirname, `../tickets/${ticketfile.split("STOP-").join("")}`));
544 | message.channel.send("", {
545 | embed: makeEmbed(message, "00FF21", `✅ ${language.finished}`, language.the_ticket_has_been_opened_again)
546 | })
547 | .catch(e => {
548 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
549 | })
550 | .then(msg => {
551 | msg.delete({
552 | timeout: 10000
553 | })
554 | .catch(e => {});
555 | });
556 | var user = client.users.cache.get(ticket.author);
557 | if (!user) {
558 | message.channel.send("", {
559 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.unknown_user)
560 | })
561 | .catch(e => {
562 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
563 | })
564 | .then(msg => {
565 | msg.delete({
566 | timeout: 10000
567 | })
568 | .catch(e => {});
569 | });
570 | return;
571 | }
572 | user.send(`${language.your_ticket_id}: ${ticket.id}`, {
573 | embed: makeEmbed(message, "0094FF", `ℹ️ ${language.your_ticket_has_been_opened_again}`, `${language.ticketid}: ${ticket.id}`)
574 | })
575 | .catch(e => {
576 | log(`An error occurred while sending a message to ${user.tag}: ${e.stack}`, 1);
577 | });
578 | break;
579 | case languageconfig.ticketteamcommand.list.toLowerCase():
580 | var page = message.content.split(" ")[2];
581 | if (!page || Number(page) < 1 || isNaN(Number(page))) {
582 | page = 1;
583 | }
584 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
585 | var j = 0;
586 | tickets.forEach(function (element) {
587 | if (!element.startsWith("STOP-")) {
588 | j++;
589 | }
590 | });
591 | var maxpages = Math.ceil(j / 10);
592 | page = Number(page);
593 | if (page > maxpages) {
594 | page = maxpages;
595 | }
596 | var embed = makeEmbed(message, "#0094FF", `ℹ️ ${language.open_tickets}`, `${language.there_are} **${j}** ${language.tickets_available} - ${language.page} ${page} ${language.of} ${maxpages}`);
597 | var i = 0;
598 | tickets.forEach(function (element, index) {
599 | if (index >= (page - 1) * 10 && i < 10 && element.split("STOP-").length === 1) {
600 | var thisticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${element}`)));
601 | embed.addField(thisticket.id, `${language.created}: ${thisticket.created}`);
602 | i++;
603 | }
604 | });
605 | message.channel.send("", {
606 | embed: embed
607 | })
608 | .catch(e => {
609 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
610 | })
611 | .then(msg => {
612 | msg.delete({
613 | timeout: 30000
614 | })
615 | .catch(e => {});
616 | });
617 | break;
618 |
619 | case languageconfig.ticketteamcommand.user.toLowerCase():
620 | if (message.mentions.members.first()) {
621 | var user = message.mentions.members.first().user.id;
622 | } else {
623 | if (isNaN(Number(message.content.split(" ")[2]))) {
624 | message.channel.send("", {
625 | embed: makeEmbed(message, "FF0000", `❗ ${language.oops}`, language.please_enter_a_ticketid, [{
626 | title: language.usage_of_this_command,
627 | value: `${config.prefix}${languageconfig.ticketteamcommand.main} ${languageconfig.ticketteamcommand.user} <${language.userid_or_mention}> <${language.page}>`
628 | }])
629 | })
630 | .catch(e => {
631 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
632 | })
633 | .then(msg => {
634 | msg.delete({
635 | timeout: 10000
636 | })
637 | .catch(e => {});
638 | });
639 | return;
640 | }
641 | var user = message.content.split(" ")[2];
642 | }
643 | var page = Number(message.content.split(" ")[3]);
644 | if (!page || isNaN(page) || page <= 0) {
645 | page = 1;
646 | }
647 | var tickets = fs.readdirSync(path.join(__dirname, `../tickets/`));
648 | var tickets = tickets.filter(function (element) {
649 | return (element.split("-")[1] === user || element.split("-")[2] === user);
650 | });
651 | if (tickets.length <= 0) {
652 | message.channel.send("", {
653 | embed: makeEmbed(message, "FF0000", `❗ ${language.no_tickets_found}`, `${language.the_user} ${message.guild.members.cache.get(user) ? message.guild.members.cache.get(user).user.username:user} ${language.has_not_yet_created_a_ticket}`)
654 | })
655 | .catch(e => {
656 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
657 | })
658 | .then(msg => {
659 | msg.delete({
660 | timeout: 10000
661 | })
662 | .catch(e => {});
663 | });
664 | return;
665 | }
666 | var maxpages = Math.ceil(tickets.length / 10);
667 | if (page > maxpages) {
668 | page = maxpages;
669 | }
670 | var fields = [];
671 | for (var i = (page - 1) * 10; i < tickets.length && i < 10; i++) {
672 | var currticket = JSON.parse(fs.readFileSync(path.join(__dirname, `../tickets/${tickets[i]}`)));
673 | fields.push({
674 | title: currticket.id,
675 | value: `${language.created}: ${new Date(currticket.created)}`
676 | });
677 | }
678 | message.channel.send("", {
679 | embed: makeEmbed(message, "0094FF", `ℹ️ ${language.all_tickets_from} ${message.guild.members.cache.get(user) ? message.guild.members.cache.get(user).user.username:user}`, `${language.page} ${page} ${language.of} ${maxpages}`, fields)
680 | })
681 | .catch(e => {
682 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
683 | })
684 | .then(msg => {
685 | msg.delete({
686 | timeout: 30000
687 | })
688 | .catch(e => {});
689 | });
690 | return;
691 | default:
692 | message.channel.send("", {
693 | embed: makeEmbed(message, "#FF0000", `❗ ${language.oops}`, language.please_enter_an_action, [{
694 | title: language.you_have_the_following_options,
695 | value: `${languageconfig.ticketteamcommand.info}, ${languageconfig.ticketteamcommand.answer}, ${languageconfig.ticketteamcommand.close}, ${languageconfig.ticketteamcommand.reopen}, ${languageconfig.ticketteamcommand.list}, ${languageconfig.ticketteamcommand.user}`
696 | }])
697 | })
698 | .catch(e => {
699 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
700 | return;
701 | })
702 | .then(msg => {
703 | msg.delete({
704 | timeout: 10000
705 | })
706 | .catch(e => {});
707 | });
708 | return;
709 | }
710 | }
711 | }
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "token": "ENTER YOUR DISCORD BOT TOKEN HERE",
3 | "server_id": "ENTER YOUR SERVER-ID HERE",
4 | "prefix": "/",
5 | "ticket_notification_channel_id": "ENTER THE CHANNELID WHERE TICKET NOTIFICATIONS SHOULD BE POSTED HERE",
6 | "team_role_id": "ENTER THE ID OF YOUR TEAMS ROLE HERE",
7 | "errorOnCommandNotFound": true,
8 | "language": "en_EN",
9 | "custom_status": null
10 | }
--------------------------------------------------------------------------------
/failsafe.js:
--------------------------------------------------------------------------------
1 | /*Failsafe System Version 1.1.6
2 | (CC-BY-NC-ND-4.0) AstroGD - www.astrogd.de
3 | Edited by Cherob - www.cherob.eu */
4 |
5 | //Required Modules and Files
6 | const cp = require("child_process");
7 | const package = require(`${__dirname}/package.json`);
8 |
9 | let title = " ______ _ _ _____ \n"
10 | + " | ____| (_)| | / ____| \n"
11 | + " | |__ __ _ _ | || (___ __ _ __ __ ___ \n"
12 | + " | __|/ _` || || | \\___ \\ / _` |\\ \\ / // _ \\ \n"
13 | + " | | | (_| || || | ____) || (_| | \\ V /| __/ \n"
14 | + " |_| \\__,_||_||_||_____/ \\__,_| \\_/ \\___|"
15 | var filedirectory = "/main.js";
16 | var version = "1.1.5";
17 |
18 | let unixtime = ('[' + Math.round((new Date()).getTime() / 1000) + ']');
19 |
20 | function start() {
21 | console.log(`\n ${title} - V${version} -\n`);
22 | let programm = cp.fork(`${__dirname}${filedirectory}`);
23 | programm.on('exit', (code, signal) => {
24 | switch (code) {
25 | case 28:
26 | console.log(`\nAn unknown Error occurred. Shutting down.`
27 | + `\nThe Programm is being closed in 3 Seconds`);
28 | setTimeout(function () { process.exit(); }, 3000);
29 | break;
30 | case 29:
31 | console.log(`\nSystem thread encountered an error.`
32 | + `\nThe Programm is being restarted in 5 Seconds`);
33 | setTimeout(function () { start(); }, 5000);
34 | break;
35 | default:
36 | console.log(`\nSystem thread crashed unexpectedly`
37 | + `\nCode: ${code}`
38 | + `\nSignal: ${signal}`
39 | + `\nThe Programm is being restarted in 10 Seconds`);
40 | setTimeout(function () { start(); }, 10000);
41 | break;
42 | }
43 | });
44 | console.log(unixtime, `Starting "${package.name}.js"`);
45 | console.log(unixtime, "OUTPUT PROGRAMM");
46 | }
47 |
48 | //startup after loading
49 | start();
50 |
--------------------------------------------------------------------------------
/lang/de_DE.json:
--------------------------------------------------------------------------------
1 | {
2 | "settings": {
3 | "ticketcommand": {
4 | "main": "ticket",
5 | "create": "start",
6 | "info": "info",
7 | "answer": "antwort",
8 | "close": "stop"
9 | },
10 | "ticketteamcommand": {
11 | "main": "ticketteam",
12 | "info": "info",
13 | "answer": "antwort",
14 | "close": "stop",
15 | "reopen": "öffnen",
16 | "list": "liste",
17 | "user": "user"
18 | },
19 | "helpcommand": {
20 | "main": "hilfe"
21 | }
22 | },
23 | "translations": {
24 | "oops": "Ups",
25 | "please_tell_us_what_happened": "Bitte teile uns mit, was passiert ist",
26 | "usage_of_this_command": "Benutzung des Befehls",
27 | "message": "Nachricht",
28 | "your_original_message": "Deine ursprüngliche Nachricht",
29 | "your_message_is_too_long": "Deine Nachricht ist zu lang",
30 | "a_maximum_of_800_characters_is_allowed": "Es sind maximal 800 Zeichen erlaubt.",
31 | "uploaded_images_cant_be_processed_please_send_them_as_a_link_in_the_text": "Hochgeladene Bilder können nicht verarbeitet werden. Bitte sende sie als Link im Text.",
32 | "ticket_started": "Ticket gestartet",
33 | "finished": "Fertig",
34 | "your_ticket_was_successfully_created_it_has_the_following_id": "Dein Ticket wurde erfolgreich erstellt. Es hat die folgende ID",
35 | "to_access_your_ticket_please_use_this_id": "Um auf dein Ticket zuzugreifen, nutze bitte diese ID.",
36 | "your_message": "Deine Nachricht",
37 | "your_ticket_id": "Deine Ticketid",
38 | "it_seems_youve_disabled_direct_messaging_please_activate_these_via_the_data_protection_settings_of_the_server": "Es scheint, du hast Direktnachrichten deaktiviert. Bitte aktiviere diese über die Datenschutzeinstellungen des Servers",
39 | "new_ticket": "Neues Ticket",
40 | "author": "Autor",
41 | "created": "Erstellt",
42 | "ticketid": "Ticketid",
43 | "unknown_user": "Unbekannter User",
44 | "message_history": "Nachrichtenverlauf",
45 | "please_enter_a_ticketid": "Bitte gib eine Ticketid an",
46 | "unknown_ticket_id": "Unbekannte Ticketid",
47 | "ticket_closed": "Ticket geschlossen",
48 | "your_tickets_been_closed_please_contact_the_team_if_this_is_a_mistake": "Dein Ticket wurde geschlossen. Bitte melde dich beim Team, wenn das ein Fehler ist",
49 | "this_ticket_was_not_created_by_you": "Dieses Ticket wurde nicht von dir erstellt",
50 | "information_about_the_selected_ticket": "Information zum gewählten Ticket",
51 | "displays_the_last_10_messages_and_the_original_request": "Zeigt die letzten 10 gesendeten Nachrichten und die Ursprüngliche Anfrage an",
52 | "at": "am",
53 | "please_enter_a_message": "Bitte gib eine Nachricht an",
54 | "an_error_occurred": "Es ist ein Fehler aufgetreten",
55 | "error": "Fehler",
56 | "your_message_has_been_sent": "Deine Nachricht wurde versendet",
57 | "you_replied_to_your_ticket": "Du hast auf dein Ticket geantwortet",
58 | "new_message": "Neue Nachricht",
59 | "there_is_a_new_answer_for_the_ticket": "Es gibt eine neue Antwort für das Ticket",
60 | "the_ticket_has_already_been_closed": "Das Ticket wurde bereits geschlossen",
61 | "the_ticket_was_closed_by_the_user": "Das Ticket wurde vom User geschlossen",
62 | "your_ticket_has_been_closed": "Dein Ticket wurde geschlossen",
63 | "the_following_ticket_has_been_closed": "Das folgende Ticket wurde geschlossen",
64 | "help_for": "Hilfe für",
65 | "starts_a_new_ticket": "Startet ein neues Ticket",
66 | "sends_information_about_a_ticket": "Sendet Informationen zu einem Ticket",
67 | "sends_an_answer_to_a_ticket": "Sendet eine Antwort zu einem Ticket",
68 | "closes_a_ticket": "Schließt ein Ticket",
69 | "the_team_role_stored_in_the_bots_config_is_invalid_please_contact_an_administrator": "Die in der Config des Bots gespeicherte Teamrolle ist ungültig. Bitte kontaktiere einen Administrator.",
70 | "you_do_not_have_the_required_authorization_to_use_this_command": "Du hast nicht die benötigte Berechtigung, diesen Befehl zu benutzen.",
71 | "attention": "Achtung",
72 | "you_can_no_longer_reply_to_this_ticket": "Du kannst auf dieses Ticket nicht mehr antworten",
73 | "responded_to_the_ticket": "hat auf das Ticket geantwortet",
74 | "do_you_need_more_information_about_your_ticket": "Benötigst du mehr Informationen zu deinem Ticket?",
75 | "use": "Benutze",
76 | "for_more_details_about_your_ticket": "für mehr Details zu deinem Ticket",
77 | "the_ticket_was_closed_by_a_staff_member": "Das Ticket wurde durch ein Teammitglied geschlossen",
78 | "the_ticket_has_been_closed": "Das Ticket wurde geschlossen",
79 | "the_ticket_is_already_open": "Das Ticket ist bereits offen",
80 | "the_ticket_has_been_opened_by_a_staff_member": "Das Ticket wurde durch ein Teammitglied geöffnet",
81 | "the_ticket_has_been_opened_again": "Das Ticket wurde wieder geöffnet",
82 | "your_ticket_has_been_opened_again": "Dein Ticket wurde wieder geöffnet",
83 | "open_tickets": "Offene Tickets",
84 | "there_are": "Es sind",
85 | "tickets_available": "Tickets verfügbar",
86 | "page": "Seite",
87 | "of": "von",
88 | "userid_or_mention": "UserID / Mention",
89 | "no_tickets_found": "Keine Tickets gefunden",
90 | "the_user": "Der User",
91 | "has_not_yet_created_a_ticket": "hat bis jetzt noch kein Ticket erstellt",
92 | "all_tickets_from": "Alle Tickets von",
93 | "please_enter_an_action": "Bitte gib eine Aktion ein",
94 | "you_have_the_following_options": "Du hast die folgenden Optionen",
95 | "help": "Hilfe",
96 | "information_to_the_use_of_the_ticket_system": "Informationen zur Nutzung des Ticketsystems",
97 | "for_staff_members": "Für Teammitglieder",
98 | "reopens_a_ticket": "Öffnet ein Ticket erneut",
99 | "shows_a_list_of_all_open_tickets": "Zeigt eine Liste aller offenen Tickets",
100 | "shows_a_list_of_tickets_created_by_a_specific_user": "Zeigt eine Liste mit Tickets, welche von einem bestimmten Nutzer erstellt wurden",
101 | "ticket_system": "Ticketsystem",
102 | "this_command_does_not_exist_please_use_the_help_command_to_get_a_list_of_all_commands": "Dieser Befehl existiert leider nicht. Bitte nutze den Hilfe Befehl, um eine Liste aller Befehle zu erhalten.",
103 | "this_bot_is_not_usable_via_dm": "Dieser Bot ist nicht über die Direktnachrichten nutzbar.",
104 | "please_enter_your_command_on_our_server": "Bitte gib deinen Befehl auf unserem Server ein."
105 | }
106 | }
--------------------------------------------------------------------------------
/lang/en_EN.json:
--------------------------------------------------------------------------------
1 | {
2 | "settings": {
3 | "ticketcommand": {
4 | "main": "ticket",
5 | "create": "create",
6 | "info": "info",
7 | "answer": "answer",
8 | "close": "close"
9 | },
10 | "ticketteamcommand": {
11 | "main": "tteam",
12 | "info": "info",
13 | "answer": "answer",
14 | "close": "close",
15 | "reopen": "reopen",
16 | "list": "list",
17 | "user": "user"
18 | },
19 | "helpcommand": {
20 | "main": "help"
21 | }
22 | },
23 | "translations": {
24 | "oops": "Oops",
25 | "please_tell_us_what_happened": "Please tell us what happened",
26 | "usage_of_this_command": "Usage of this command",
27 | "message": "Message",
28 | "your_original_message": "Your original Message",
29 | "your_message_is_too_long": "Your Message is too long",
30 | "a_maximum_of_800_characters_is_allowed": "A maximum of 800 characters is allowed.",
31 | "uploaded_images_cant_be_processed_please_send_them_as_a_link_in_the_text": "Uploaded images can't be processed. Please send them as a link in the text.",
32 | "ticket_started": "Ticket started",
33 | "finished": "Finished",
34 | "your_ticket_was_successfully_created_it_has_the_following_id": "Your ticket was successfully created. It has the following ID:",
35 | "to_access_your_ticket_please_use_this_id": "To access your ticket please use this ID.",
36 | "your_message": "Your Message",
37 | "your_ticket_id": "Your Ticketid",
38 | "it_seems_youve_disabled_direct_messaging_please_activate_these_via_the_data_protection_settings_of_the_server": "It seems you've disabled direct messaging. Please activate these via data protection settings of the server.",
39 | "new_ticket": "New ticket",
40 | "author": "Author",
41 | "created": "Created",
42 | "ticketid": "Ticketid",
43 | "unknown_user": "Unknown User",
44 | "message_history": "Message history",
45 | "please_enter_a_ticketid": "Please enter a Ticketid",
46 | "unknown_ticket_id": "Unknown Ticketid",
47 | "ticket_closed": "Ticket closed",
48 | "your_tickets_been_closed_please_contact_the_team_if_this_is_a_mistake": "Your Ticket's been closed. Please contact the team if this is a mistake.",
49 | "this_ticket_was_not_created_by_you": "This ticket was not created by you",
50 | "information_about_the_selected_ticket": "Information about the selected ticket",
51 | "displays_the_last_10_messages_and_the_original_request": "Shows the last 10 messages and the original request",
52 | "at": "at",
53 | "please_enter_a_message": "Please enter a message",
54 | "an_error_occurred": "An error occurred",
55 | "error": "Error",
56 | "your_message_has_been_sent": "Your Message has been sent",
57 | "you_replied_to_your_ticket": "You replied to your ticket",
58 | "new_message": "New Message",
59 | "there_is_a_new_answer_for_the_ticket": "There is a new answer for the ticket",
60 | "the_ticket_has_already_been_closed": "The ticket has already been closed",
61 | "the_ticket_was_closed_by_the_user": "The ticket was closed by the user",
62 | "your_ticket_has_been_closed": "Your ticket has been closed",
63 | "the_following_ticket_has_been_closed": "The following ticket has been closed",
64 | "help_for": "Help for",
65 | "starts_a_new_ticket": "Starts a new ticket",
66 | "sends_information_about_a_ticket": "Sends information about a ticket",
67 | "sends_an_answer_to_a_ticket": "Sends an answer to a ticket",
68 | "closes_a_ticket": "Closes a ticket",
69 | "the_team_role_stored_in_the_bots_config_is_invalid_please_contact_an_administrator": "The team role stored in the bots config is invalid. Please contact an administrator.",
70 | "you_do_not_have_the_required_authorization_to_use_this_command": "You do not have the required authorization to use this command",
71 | "attention": "Attention",
72 | "you_can_no_longer_reply_to_this_ticket": "You can no longer reply to this ticket",
73 | "responded_to_the_ticket": "responded to the ticket",
74 | "do_you_need_more_information_about_your_ticket": "Do you need more information about your ticket?",
75 | "use": "Use",
76 | "for_more_details_about_your_ticket": "for more details about your ticket",
77 | "the_ticket_was_closed_by_a_staff_member": "The ticket was closed by a staff member",
78 | "the_ticket_has_been_closed": "The ticket has been closed",
79 | "the_ticket_is_already_open": "The ticket is already open",
80 | "the_ticket_has_been_opened_by_a_staff_member": "The ticket has been opened by a staff member",
81 | "the_ticket_has_been_opened_again": "The ticket has been opened again",
82 | "your_ticket_has_been_opened_again": "Your ticket has been opened again",
83 | "open_tickets": "Open tickets",
84 | "there_are": "There are",
85 | "tickets_available": "tickets available",
86 | "page": "Page",
87 | "of": "of",
88 | "userid_or_mention": "UserID / Mention",
89 | "no_tickets_found": "No tickets found",
90 | "the_user": "The User",
91 | "has_not_yet_created_a_ticket": "has not yet created a ticket.",
92 | "all_tickets_from": "All tickets from",
93 | "please_enter_an_action": "Please enter an action",
94 | "you_have_the_following_options": "You have the following options",
95 | "help": "Help",
96 | "information_to_the_use_of_the_ticket_system": "Information to the use of the ticket system",
97 | "for_staff_members": "For staff members",
98 | "reopens_a_ticket": "Reopens a ticket",
99 | "shows_a_list_of_all_open_tickets": "Shows a list of all open tickets",
100 | "shows_a_list_of_tickets_created_by_a_specific_user": "Shows a list of tickets created by a specific user",
101 | "ticket_system": "Ticket-system",
102 | "this_command_does_not_exist_please_use_the_help_command_to_get_a_list_of_all_commands": "This command does not exist. Please use the help command to get a list of all commands.",
103 | "this_bot_is_not_usable_via_dm": "This bot is not usable via dm.",
104 | "please_enter_your_command_on_our_server": "Please enter your command on our server"
105 | }
106 | }
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Ticketsystem by AstroGD
3 | * @author AstroGD (https://www.astrogd.eu)
4 | * @version 2.0.3
5 | * @since 15. Mai 2018
6 | * @link https://www.astrogd.eu
7 | * @license AGPL-3.0
8 | */
9 |
10 | console.log(`[I] Loader: Loading Code`);
11 |
12 | //Requirements
13 | const Discord = require("discord.js");
14 | const fs = require("fs-extra");
15 | const path = require("path");
16 |
17 | //Variables
18 | const startupdate = new Date();
19 | const timestamp = `${startupdate.getFullYear()}-${startupdate.getMonth() + 1}-${startupdate.getDate()}-${startupdate.getHours()}-${startupdate.getMinutes()}-${startupdate.getSeconds()}`;
20 | const client = new Discord.Client();
21 | const pk = require(path.join(__dirname, "/package.json"));
22 | var language, languageconfig, commands;
23 |
24 | //Modules
25 | const request = require(path.join(__dirname, "/request.js"));
26 | const makeEmbed = require(path.join(__dirname, "/makeEmbed.js"))(client);
27 |
28 | //Path Ensurances
29 | fs.ensureDirSync(path.join(__dirname, "/log/"));
30 | fs.ensureDirSync(path.join(__dirname, "/tickets/"));
31 | fs.ensureDirSync(path.join(__dirname, "/lang"));
32 |
33 | //Files
34 | var config = require(`${__dirname}/config.json`);
35 | var stream = fs.createWriteStream(`${__dirname}/log/${timestamp}.log`);
36 |
37 | //Functions
38 | function log(msg, status = "INFO", consoletype = 1) {
39 | let dateCurrent = new Date();
40 | const timestampCurrent = `${dateCurrent.getFullYear()}-${dateCurrent.getMonth() + 1}-${dateCurrent.getDay()}-${dateCurrent.getHours()}-${dateCurrent.getMinutes()}-${dateCurrent.getSeconds()}`;
41 |
42 | switch (status) {
43 | case 1: //ERROR
44 | status = "ERROR";
45 | break;
46 | case 2: //WARN
47 | status = "WARN";
48 | break;
49 | case 3: //DEBUG
50 | status = "DEBUG";
51 | break;
52 | default: //INFO
53 | status = "INFO";
54 | break;
55 | }
56 |
57 | if (!consoletype || (consoletype != 1 && consoletype != 2 && consoletype != 3)) consoletype = 1;
58 |
59 | let logCurrent = `[${timestampCurrent}] ${status} [Ticketsystem] ${msg.stack ? `An error occurred:\n${msg.stack}` : msg}`;
60 | if (consoletype == 1 || consoletype == 3) stream.write(logCurrent + '\n');
61 | if (consoletype == 1 || consoletype == 2) console.log(logCurrent);
62 | }
63 |
64 | async function checkVersion() {
65 | let versionInfo = null;
66 | try {
67 | versionInfo = await request({
68 | 'method': 'GET',
69 | 'hostname': 'software.astrogd.eu',
70 | 'path': '/ticketsystem/version.json',
71 | 'headers': {},
72 | 'maxRedirects': 20
73 | });
74 | } catch (error) {
75 | return log(`\x1b[31mVersion couldn't be checked! Make sure to allow network access to software.astrogd.eu\x1b[0m`, 1);
76 | }
77 |
78 | if (!versionInfo) return log(`\x1b[31mVersion couldn't be checked! Make sure to allow network access to software.astrogd.eu\x1b[0m`, 1);
79 | versionInfo = JSON.parse(versionInfo.toString());
80 |
81 | const version = pk.version.split(".");
82 | const latest = versionInfo.version.split(".");
83 |
84 | if (version[0] < latest[0] || version[0] == latest[0] && version[1] < latest[1] || version[0] == latest[0] && version[1] == latest[1] && version[2] < latest[2]) {
85 | return log(`\x1b[31mA new version of the ticketsystem is available (${pk.version} --> ${versionInfo.version}). Make sure to visit ${versionInfo.url} and download the newest version. If you need help look in the repositorys wiki under "how to update" or contact AstroGD (https://www.astrogd.eu/en/kontakt)\x1b[0m`, 2);
86 | }
87 |
88 | log(`\x1b[32mNewest version installed!\x1b[0m`, 3);
89 | };
90 |
91 | //Additional Code
92 | process.on("unhandledRejection", (reason) => {
93 | log(`An unhandled Promise Rejection occurred: ${reason}`, 1);
94 | });
95 |
96 | process.on('uncaughtException', (err) => {
97 | try {
98 | log(`An uncaught Exception took Place: ${err.stack}\n\nBot is force destroying...`, 1);
99 | } catch (e) {
100 |
101 | }
102 | try {
103 | client.destroy().then(() => {
104 | process.exit();
105 | });
106 | } catch (e) {
107 | process.exit();
108 | }
109 | return;
110 | });
111 |
112 | //Startup Function
113 | async function startup() {
114 | log(`Initialized!`);
115 | log("Starting up - Loading Bots language");
116 |
117 | if (!fs.existsSync(`${__dirname}/lang/${config.language}.json`)) {
118 | log(`Language File not found. Please download missing files or contact the developer.`, 1);
119 | process.exit(28);
120 | } else {
121 | language = JSON.parse(fs.readFileSync(`${__dirname}/lang/${config.language}.json`, "utf-8")).translations;
122 | languageconfig = JSON.parse(fs.readFileSync(`${__dirname}/lang/${config.language}.json`, "utf-8")).settings;
123 | }
124 |
125 | log("Done - Logging in");
126 |
127 | await checkVersion();
128 | setInterval(function () {
129 | checkVersion();
130 | }, 3600000); //Check version every hour
131 |
132 | client.login(config.token);
133 |
134 | client.on("ready", () => {
135 | try {
136 | log(`Online. Connected as ${client.user.tag} (${client.user.id}) - Checking Botuser`);
137 | if (!client.user.bot) {
138 | log(`Not a Bot User. This is against the Discord ToS. Program will be terminated. Please change the token in the config.`, 1);
139 | client.destroy()
140 | .then(() => {
141 | process.exit();
142 | });
143 | return;
144 | }
145 |
146 | log("Is a bot user - Checking Guild");
147 | let guild = client.guilds.cache.get(config.server_id);
148 | if (!guild) {
149 | log(`Guild not found. Please edit Config.json. Program will be terminated.`, 1);
150 | client.destroy();
151 | process.exit();
152 | }
153 |
154 | log(`Guild found. Listening to ${guild.name} (${guild.id}) - Loading commands`);
155 |
156 | client.user.setPresence({
157 | status: "online",
158 | activity: {
159 | name: config.custom_status || `${language.ticket_system} | ${config.prefix}${languageconfig.helpcommand.main}`,
160 | type: "PLAYING"
161 | }
162 | });
163 |
164 | //Commands
165 | const ticketCommand = require(path.join(__dirname, "/commands/ticket.js"))(log, makeEmbed, language, config, languageconfig, client);
166 | const ticketteamCommand = require(path.join(__dirname, "/commands/ticketteam.js"))(log, makeEmbed, language, config, languageconfig, client);
167 | const hilfeCommand = require(path.join(__dirname, "/commands/hilfe.js"))(log, makeEmbed, language, config, languageconfig);
168 | commands = {
169 | ticket: ticketCommand,
170 | ticketteam: ticketteamCommand,
171 | hilfe: hilfeCommand
172 | }
173 |
174 | log(`Done - Listening for commands.`);
175 | } catch (e) {
176 | log(`An error occurred while running Ready Event Actions: ${e.stack}`, 1);
177 | }
178 | });
179 |
180 | client.on("message", async (message) => {
181 | try {
182 | if (message.author.bot) return;
183 | if (!message.guild) {
184 | log(`Got a DM from ${message.author.tag} - Sorry but thats unwanted`);
185 | message.author.send("", {
186 | embed: makeEmbed(message, "#FF0000", `🚫 - ${language.oops}! ${language.this_bot_is_not_usable_via_dm}`, language.please_enter_your_command_on_our_server)
187 | })
188 | .catch(e => {
189 | log(`An error occurred while sending a DM to ${message.author.tag}: ${e.stack}`, 2);
190 | return;
191 | });
192 | return;
193 | }
194 | if (!message.content.startsWith(config.prefix) || message.guild.id != config.server_id) return;
195 |
196 | log(`Received commandlike message from ${message.author.tag} - Checking for Commands`);
197 |
198 | const cmd = message.content.split(config.prefix).slice(1).join(config.prefix).split(" ")[0].toLowerCase();
199 |
200 | if (cmd == languageconfig.ticketcommand.main.toLowerCase()) {
201 | message.content = `${config.prefix}ticket ${message.content.split(" ").slice(1).join(" ")}`;
202 | } else if (cmd == languageconfig.ticketteamcommand.main.toLowerCase()) {
203 | message.content = `${config.prefix}ticketteam ${message.content.split(" ").slice(1).join(" ")}`;
204 | } else if (cmd == languageconfig.helpcommand.main.toLowerCase()) {
205 | message.content = `${config.prefix}hilfe ${message.content.split(" ").slice(1).join(" ")}`;
206 | }
207 |
208 | if (!commands[message.content.split(config.prefix).slice(1).join(config.prefix).split(" ")[0].toLowerCase()]) {
209 | log(`No Command found :(`);
210 | if (config.errorOnCommandNotFound) {
211 | message.channel.send("", {
212 | embed: makeEmbed(message, "#FF0000", `⁉️ ${language.oops}`, language.this_command_does_not_exist_please_use_the_help_command_to_get_a_list_of_all_commands)
213 | })
214 | .catch(e => {
215 | log(`An error occurred while sending a message to ${message.channel.name}: ${e.stack}`, 1);
216 | return;
217 | })
218 | .then(msg => {
219 | msg.delete({timeout:10000})
220 | .catch(e => {});
221 | });
222 | }
223 | return;
224 | } else {
225 | log(`Command found :) | ${message.content.split(" ")[0].toLowerCase()}`);
226 | commands[message.content.split(config.prefix).slice(1).join(config.prefix).split(" ")[0].toLowerCase()](message);
227 | message.delete({timeout:0}).catch(e => {});
228 | return;
229 | }
230 | } catch (e) {
231 | log(`An error occurred while running Message Event Actions: ${e.stack}`, 1);
232 | }
233 | });
234 | }
235 |
236 |
237 | //Startup
238 | console.log(`[I] Loader: Code loaded. Starting Function - Activating Log Function`);
239 | startup();
--------------------------------------------------------------------------------
/makeEmbed.js:
--------------------------------------------------------------------------------
1 | module.exports = function (client) {
2 | return function (message, color, title, description, fields) {
3 | const Discord = require("discord.js");
4 |
5 | var embed = new Discord.MessageEmbed();
6 | embed.setColor(color)
7 | .setFooter("Ticket System by AstroGD", client.user.avatarURL()) //Getting my name out in the world is the only payment I get for releasing free code so I am very thankful if you leave this as it is.
8 | .setTimestamp(new Date())
9 | .setTitle(title)
10 | .setDescription(description);
11 |
12 | if (message) {
13 | embed.setAuthor(message.author.username, message.author.avatarURL());
14 | }
15 |
16 | if (fields) {
17 | for (var i = 0; i < fields.length; i++) {
18 | if (!fields[i].inline) fields[i].inline = false;
19 | if (!fields[i].empty) {
20 | embed.addField(fields[i].title, fields[i].value, fields[i].inline);
21 | } else {
22 | embed.addField('\u200b', '\u200b', fields[i].inline);
23 | }
24 | }
25 | }
26 | return embed;
27 | }
28 | }
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ticketsystem",
3 | "version": "2.0.4",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "@discordjs/collection": {
8 | "version": "0.1.6",
9 | "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
10 | "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
11 | },
12 | "@discordjs/form-data": {
13 | "version": "3.0.1",
14 | "resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
15 | "integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
16 | "requires": {
17 | "asynckit": "^0.4.0",
18 | "combined-stream": "^1.0.8",
19 | "mime-types": "^2.1.12"
20 | }
21 | },
22 | "abort-controller": {
23 | "version": "3.0.0",
24 | "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
25 | "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
26 | "requires": {
27 | "event-target-shim": "^5.0.0"
28 | }
29 | },
30 | "asynckit": {
31 | "version": "0.4.0",
32 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
33 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
34 | },
35 | "at-least-node": {
36 | "version": "1.0.0",
37 | "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
38 | "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg=="
39 | },
40 | "combined-stream": {
41 | "version": "1.0.8",
42 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
43 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
44 | "requires": {
45 | "delayed-stream": "~1.0.0"
46 | }
47 | },
48 | "delayed-stream": {
49 | "version": "1.0.0",
50 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
51 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
52 | },
53 | "discord.js": {
54 | "version": "12.5.3",
55 | "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
56 | "integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
57 | "requires": {
58 | "@discordjs/collection": "^0.1.6",
59 | "@discordjs/form-data": "^3.0.1",
60 | "abort-controller": "^3.0.0",
61 | "node-fetch": "^2.6.1",
62 | "prism-media": "^1.2.9",
63 | "setimmediate": "^1.0.5",
64 | "tweetnacl": "^1.0.3",
65 | "ws": "^7.4.4"
66 | }
67 | },
68 | "event-target-shim": {
69 | "version": "5.0.1",
70 | "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
71 | "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
72 | },
73 | "follow-redirects": {
74 | "version": "1.13.3",
75 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz",
76 | "integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA=="
77 | },
78 | "fs-extra": {
79 | "version": "9.1.0",
80 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
81 | "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
82 | "requires": {
83 | "at-least-node": "^1.0.0",
84 | "graceful-fs": "^4.2.0",
85 | "jsonfile": "^6.0.1",
86 | "universalify": "^2.0.0"
87 | }
88 | },
89 | "graceful-fs": {
90 | "version": "4.2.4",
91 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
92 | "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
93 | },
94 | "jsonfile": {
95 | "version": "6.1.0",
96 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
97 | "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
98 | "requires": {
99 | "graceful-fs": "^4.1.6",
100 | "universalify": "^2.0.0"
101 | }
102 | },
103 | "mime-db": {
104 | "version": "1.47.0",
105 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz",
106 | "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw=="
107 | },
108 | "mime-types": {
109 | "version": "2.1.30",
110 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz",
111 | "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==",
112 | "requires": {
113 | "mime-db": "1.47.0"
114 | }
115 | },
116 | "node-fetch": {
117 | "version": "2.6.1",
118 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
119 | "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
120 | },
121 | "prism-media": {
122 | "version": "1.2.9",
123 | "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.9.tgz",
124 | "integrity": "sha512-UHCYuqHipbTR1ZsXr5eg4JUmHER8Ss4YEb9Azn+9zzJ7/jlTtD1h0lc4g6tNx3eMlB8Mp6bfll0LPMAV4R6r3Q=="
125 | },
126 | "setimmediate": {
127 | "version": "1.0.5",
128 | "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
129 | "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
130 | },
131 | "tweetnacl": {
132 | "version": "1.0.3",
133 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
134 | "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
135 | },
136 | "universalify": {
137 | "version": "2.0.0",
138 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
139 | "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
140 | },
141 | "ws": {
142 | "version": "7.4.4",
143 | "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz",
144 | "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw=="
145 | }
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ticketsystem",
3 | "version": "2.0.5",
4 | "description": "Ticketsystem Discord Bot",
5 | "main": "main.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "start": "node ./failsafe.js"
9 | },
10 | "author": "AstroGD | Lukas Weber (https://www.astrogd.eu)",
11 | "license": "AGPL-3.0",
12 | "dependencies": {
13 | "discord.js": "^12.5.3",
14 | "follow-redirects": "^1.13.3",
15 | "fs-extra": "^9.1.0"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/request.js:
--------------------------------------------------------------------------------
1 | module.exports = function (opt) {
2 | return new Promise((resolve, reject) => {
3 | const https = require('follow-redirects').https;
4 |
5 | var options = opt || {
6 | 'method': 'GET',
7 | 'hostname': 'software.astrogd.eu',
8 | 'path': '/ticketsystem/version.json',
9 | 'headers': {},
10 | 'maxRedirects': 20
11 | };
12 |
13 | var req = https.request(options, function (res) {
14 | var chunks = [];
15 |
16 | res.on("data", function (chunk) {
17 | chunks.push(chunk);
18 | });
19 |
20 | res.on("end", function () {
21 | var body = Buffer.concat(chunks);
22 | resolve(body);
23 | });
24 |
25 | res.on("error", function (error) {
26 | reject(error);
27 | });
28 | });
29 |
30 | req.end();
31 | });
32 | }
--------------------------------------------------------------------------------