create-chapter 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +4 -1
  3. package/package.json +1 -1
  4. package/templates/community/.env.example +4 -0
  5. package/templates/community/_gitignore +5 -0
  6. package/templates/community/package.json +23 -0
  7. package/templates/community/src/messages.ts +49 -0
  8. package/templates/community/src/presence.ts +6 -0
  9. package/templates/community/src/roles/roles.ts +60 -0
  10. package/templates/community/src/stats/weekly.ts +50 -0
  11. package/templates/community/src/welcome/channel.ts +19 -0
  12. package/templates/community/src/welcome/welcome.ts +37 -0
  13. package/templates/community/tsconfig.json +20 -0
  14. package/templates/default/_gitignore +1 -0
  15. package/templates/default/package.json +1 -1
  16. package/templates/default/src/events/ready.ts +14 -20
  17. package/templates/moderation/.env.example +4 -0
  18. package/templates/moderation/_gitignore +5 -0
  19. package/templates/moderation/package.json +23 -0
  20. package/templates/moderation/src/moderation/channel.ts +67 -0
  21. package/templates/moderation/src/moderation/log.ts +37 -0
  22. package/templates/moderation/src/moderation/messages.ts +158 -0
  23. package/templates/moderation/src/moderation/purge.ts +30 -0
  24. package/templates/moderation/src/moderation/timeout.ts +82 -0
  25. package/templates/moderation/src/moderation/warn.ts +61 -0
  26. package/templates/moderation/src/presence.ts +6 -0
  27. package/templates/moderation/tsconfig.json +20 -0
  28. package/templates/music/.env.example +4 -0
  29. package/templates/music/_gitignore +5 -0
  30. package/templates/music/package.json +23 -0
  31. package/templates/music/src/music/leave.ts +18 -0
  32. package/templates/music/src/music/messages.ts +83 -0
  33. package/templates/music/src/music/play.ts +120 -0
  34. package/templates/music/src/music/queue-command.ts +28 -0
  35. package/templates/music/src/music/queue.ts +61 -0
  36. package/templates/music/src/presence.ts +6 -0
  37. package/templates/music/tsconfig.json +20 -0
  38. package/templates/tickets/.env.example +4 -0
  39. package/templates/tickets/_gitignore +5 -0
  40. package/templates/tickets/package.json +23 -0
  41. package/templates/tickets/src/presence.ts +6 -0
  42. package/templates/tickets/src/tickets/close.ts +39 -0
  43. package/templates/tickets/src/tickets/messages.ts +68 -0
  44. package/templates/tickets/src/tickets/open.ts +81 -0
  45. package/templates/tickets/src/tickets/panel.ts +35 -0
  46. package/templates/tickets/tsconfig.json +20 -0
  47. package/templates/default/public/hello.ogg +0 -0
  48. package/templates/default/src/(moderation)/ban.ts +0 -49
  49. package/templates/default/src/(moderation)/checks.ts +0 -19
  50. package/templates/default/src/(moderation)/kick.ts +0 -27
  51. package/templates/default/src/(moderation)/messages.ts +0 -81
  52. package/templates/default/src/(moderation)/warn.ts +0 -42
  53. package/templates/default/src/commands/hello.ts +0 -23
  54. package/templates/default/src/commands/ping.ts +0 -55
  55. package/templates/default/src/commands/play.ts +0 -41
  56. package/templates/default/src/events/wave.ts +0 -14
  57. package/templates/default/src/messages/en-US.ts +0 -36
  58. package/templates/default/src/messages/fr.ts +0 -37
  59. package/templates/default/src/presence.ts +0 -8
@@ -1,55 +0,0 @@
1
- import { button, command } from 'chapterjs';
2
-
3
- // A command is declared with command() and exported: `name` is what people
4
- // type after the /. Where the file is and what it is called are up to you:
5
- // this one could live anywhere in src/.
6
- export default command({
7
- name: 'ping',
8
- // Only the person sees the answer, so `t` speaks their language.
9
- ephemeral: true,
10
- async run({ interaction, t }) {
11
- // The button below, with the data it carries, and a text of
12
- // src/messages/ in the language of who will read the answer.
13
- await interaction.reply({
14
- content: t('pong'),
15
- components: [again({ count: 1 })],
16
- });
17
- },
18
- });
19
-
20
- // A button is declared with button() and exported: the name of the export
21
- // (here `again`) is what tells which one was clicked, you never write an
22
- // id. `data` is what the button carries from one click to the next.
23
- export const again = button({
24
- label: 'Again',
25
- data: { count: 'number' },
26
- async run({ interaction, data, t }) {
27
- const count = data.count + 1;
28
- // Changes the message the button is on, instead of sending a new one.
29
- await interaction.update({
30
- content: t('again', { count }),
31
- components: [again({ count })],
32
- });
33
- },
34
- });
35
-
36
- // A command can ask for options, typed for you in `run`, suggest values
37
- // while the person types, and make each person wait between two uses:
38
- //
39
- // export const hello = command({
40
- // name: 'hello',
41
- // description: 'Says hello to someone',
42
- // cooldown: '10s',
43
- // options: {
44
- // who: { type: 'user', description: 'Who to greet', required: true },
45
- // greeting: { type: 'string', description: 'How to greet' },
46
- // },
47
- // autocomplete: {
48
- // // Called while the person types in "greeting", with what they typed.
49
- // greeting: ({ value }) =>
50
- // ['Hello', 'Hi', 'Hey'].filter(word => word.startsWith(value)),
51
- // },
52
- // async run({ interaction, options }) {
53
- // await interaction.reply(`${options.greeting ?? 'Hello'} ${options.who}!`);
54
- // },
55
- // });
@@ -1,41 +0,0 @@
1
- import { command } from 'chapterjs';
2
-
3
- // /play plays a song in your voice channel: a file you send with the
4
- // command, or a link to an audio file or a stream. play() takes both.
5
- export default command({
6
- name: 'play',
7
- options: {
8
- file: { type: 'attachment' },
9
- url: { type: 'string' },
10
- },
11
- async run({ interaction, member, options, t }) {
12
- const { file, url } = options;
13
- const song = file ?? url;
14
- if (
15
- !song ||
16
- (file && !file.contentType?.startsWith('audio/')) ||
17
- (url && !/^https?:\/\//.test(url))
18
- ) {
19
- await interaction.reply({ content: t('nothingToPlay'), ephemeral: true });
20
- return;
21
- }
22
- const channel = member.voiceChannel;
23
- if (!channel) {
24
- await interaction.reply({ content: t('joinVoice'), ephemeral: true });
25
- return;
26
- }
27
- const name = file?.filename ?? url ?? '';
28
- await interaction.reply(
29
- t('playing', { song: name, channel: channel.name })
30
- );
31
- // Joining the channel the bot is already in changes nothing, and a new
32
- // play() replaces what was playing.
33
- const voice = await channel.join();
34
- // Whatever happens while it plays, the bot leaves after.
35
- try {
36
- await voice.play(song);
37
- } finally {
38
- await voice.leave();
39
- }
40
- },
41
- });
@@ -1,14 +0,0 @@
1
- import { event } from 'chapterjs';
2
-
3
- // Runs every time someone adds a reaction to a message of your server.
4
- // Reactions of bots, yours included, are left out: when yours waves back
5
- // below, this does not run again. Other events work the same way:
6
- // voiceJoin, pollVoteAdd, banAdd... (see the list of events in the docs).
7
- export default event({
8
- name: 'reactionAdd',
9
- async run({ emoji, channel, messageId }) {
10
- if (emoji.name !== '👋') return;
11
- const message = await channel.fetchMessage(messageId);
12
- await message.react('👋');
13
- },
14
- });
@@ -1,36 +0,0 @@
1
- import { language } from 'chapterjs';
2
-
3
- // A language is declared with language(): `locale` says which one. Each
4
- // function of your project receives `t`, which picks the language of who
5
- // will read the message: t('pong'), t('again', { count }).
6
- export default language({
7
- locale: 'en-US',
8
- // The language used when the one of a person or of a server is not here.
9
- default: true,
10
- texts: {
11
- pong: 'Pong! in en-US',
12
- again: 'Pong in en-US ! ×{count}',
13
- joinVoice: 'Join a voice channel first, then ask again.',
14
- hello: 'Coming to {channel}!',
15
- nothingToPlay:
16
- 'Send an audio file (.mp3, .ogg...) or a link starting with https://.',
17
- playing: 'Playing {song} in {channel}.',
18
- },
19
- // What Discord shows of each command, by its name: its description, and
20
- // the ones of its options. A command described here has none in its file.
21
- commands: {
22
- ping: {
23
- description: 'Replies with Pong!',
24
- },
25
- hello: {
26
- description: 'Says hello in your voice channel',
27
- },
28
- play: {
29
- description: 'Plays a song in your voice channel',
30
- options: {
31
- file: { description: 'A song to play' },
32
- url: { description: 'Or the link of a song or a stream' },
33
- },
34
- },
35
- },
36
- });
@@ -1,37 +0,0 @@
1
- import { language } from 'chapterjs';
2
-
3
- // Every language has the texts of the default one, with the same
4
- // {placeholders}: a missing one is reported when the file loads.
5
- export default language({
6
- locale: 'fr',
7
- texts: {
8
- pong: 'Pong! en fr',
9
- again: 'Pong en fr ! ×{count}',
10
- joinVoice: 'Rejoignez d’abord un salon vocal, puis redemandez.',
11
- hello: 'J’arrive dans {channel} !',
12
- nothingToPlay:
13
- 'Envoyez un fichier audio (.mp3, .ogg...) ou un lien qui commence par https://.',
14
- playing: 'Lecture de {song} dans {channel}.',
15
- },
16
- // What the bot answers by itself can be translated too, phrase by phrase:
17
- //
18
- // framework: {
19
- // command: 'commande',
20
- // failed: "Quelque chose s'est mal passé avec cette {what}.",
21
- // },
22
- commands: {
23
- ping: {
24
- description: 'Répond avec Pong !',
25
- },
26
- hello: {
27
- description: 'Dit bonjour dans votre salon vocal',
28
- },
29
- play: {
30
- description: 'Joue une musique dans votre salon vocal',
31
- options: {
32
- file: { description: 'Une musique à jouer' },
33
- url: { description: 'Ou le lien d’une musique ou d’un flux' },
34
- },
35
- },
36
- },
37
- });
@@ -1,8 +0,0 @@
1
- import { presence } from 'chapterjs';
2
-
3
- // What your bot shows under its name: its status, and what it is doing.
4
- // Save this file and chapterjs dev changes it at once.
5
- export default presence({
6
- status: 'online',
7
- activity: { type: 'playing', name: 'with ChapterJS' },
8
- });