Skip to content

Commit 60f62f7

Browse files
committed
feat: PRs
1 parent acd4bad commit 60f62f7

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

src/commands/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import mongodb from './mongodb';
1717
import mydevil from './mydevil';
1818
import npm from './npm';
1919
import odpowiedz from './odpowiedz';
20+
import prs from './prs';
2021
import prune from './prune';
2122
import quiz from './quiz';
2223
import regulamin from './regulamin';
@@ -28,9 +29,9 @@ import stats from './stats';
2829
import typeofweb from './towarticle';
2930
import wiki from './wiki';
3031
import xd from './xd';
32+
import xkcd from './xkcd';
3133
import yesno from './yesno';
3234
import youtube from './youtube';
33-
import xkcd from './xkcd';
3435

3536
export const COMMAND_PATTERN = new RegExp(getConfig('PREFIX') + '([a-z1-9]+)(?: (.*))?');
3637

@@ -47,6 +48,7 @@ const allCommands = [
4748
mydevil,
4849
npm,
4950
odpowiedz,
51+
prs,
5052
prune,
5153
quiz,
5254
regulamin,
@@ -58,9 +60,9 @@ const allCommands = [
5860
typeofweb,
5961
wiki,
6062
xd,
63+
xkcd,
6164
yesno,
6265
youtube,
63-
xkcd,
6466
];
6567

6668
const cooldowns = new Discord.Collection<string, Discord.Collection<string, number>>();

src/commands/prs.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Command } from '../types';
2+
3+
const formatter = new Intl.ListFormat('pl', { style: 'long', type: 'conjunction' });
4+
5+
const link: Command = {
6+
name: 'prs',
7+
description: 'PRs are welcome',
8+
args: 'required',
9+
async execute(msg) {
10+
if (!msg.mentions.members?.size) {
11+
return null;
12+
}
13+
14+
const mentions = formatter.format(msg.mentions.members.map((m) => m.toString()));
15+
16+
await msg.delete();
17+
await msg.channel.send(`PRs are welcome ${mentions}`);
18+
return null;
19+
},
20+
};
21+
22+
export default link;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"emitDecoratorMetadata": true,
66
"esModuleInterop": true,
77
"experimentalDecorators": true,
8-
"lib": ["es2020"],
8+
"lib": ["es2021"],
99
"module": "commonjs",
1010
"noFallthroughCasesInSwitch": true,
1111
"noImplicitReturns": true,

typings/dom.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare namespace Intl {
2+
interface ListFormatOptions {
3+
style: 'long' | 'short';
4+
type: 'conjunction' | 'disjunction';
5+
}
6+
7+
class ListFormat {
8+
constructor(locales?: string | string[], options?: Intl.ListFormatOptions);
9+
public format(items: string[]): string;
10+
}
11+
}

0 commit comments

Comments
 (0)