File tree Expand file tree Collapse file tree 7 files changed +56
-6
lines changed Expand file tree Collapse file tree 7 files changed +56
-6
lines changed Original file line number Diff line number Diff line change 9
9
],
10
10
"dependencies" : {
11
11
"@sentry/node" : " ^6.4.1" ,
12
- "detritus-client" : " ^0.16.4-beta.4 " ,
12
+ "detritus-client" : " ^0.16.4-beta.5 " ,
13
13
"emoji-aware" : " ^3.0.5" ,
14
14
"juration" : " ^0.1.1" ,
15
15
"moment" : " ^2.29.1" ,
Original file line number Diff line number Diff line change 1
1
import { BaseSlashCommand } from '../../basecommand' ;
2
2
3
3
import { ToolsHashCommand } from './hash' ;
4
+ import { ToolsScreenshotCommand } from './screenshot' ;
4
5
5
6
6
7
export default class ToolsGroupCommand extends BaseSlashCommand {
@@ -11,6 +12,7 @@ export default class ToolsGroupCommand extends BaseSlashCommand {
11
12
super ( {
12
13
options : [
13
14
new ToolsHashCommand ( ) ,
15
+ new ToolsScreenshotCommand ( ) ,
14
16
] ,
15
17
} ) ;
16
18
}
Original file line number Diff line number Diff line change
1
+ import { Interaction } from 'detritus-client' ;
2
+
3
+ import { Formatter , Parameters } from '../../../../utils' ;
4
+
5
+ import { BaseInteractionCommandOption } from '../../basecommand' ;
6
+
7
+
8
+ export class ToolsScreenshotCommand extends BaseInteractionCommandOption {
9
+ description = 'Screenshot a website' ;
10
+ name = 'screenshot' ;
11
+
12
+ constructor ( ) {
13
+ super ( {
14
+ options : [
15
+ {
16
+ name : 'url' ,
17
+ description : 'URL to screenshot' ,
18
+ required : true ,
19
+ value : Parameters . url ,
20
+ } ,
21
+ ] ,
22
+ } ) ;
23
+ }
24
+
25
+ async run ( context : Interaction . InteractionContext , args : Formatter . Commands . ToolsScreenshot . CommandArgs ) {
26
+ return Formatter . Commands . ToolsScreenshot . createMessage ( context , args ) ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change 1
1
import { Command , CommandClient } from 'detritus-client' ;
2
2
3
- import { utilitiesScreenshot } from '../../../api' ;
4
3
import { CommandTypes } from '../../../constants' ;
5
- import { Parameters , imageReply } from '../../../utils' ;
4
+ import { Formatter , Parameters } from '../../../utils' ;
6
5
7
6
import { BaseCommand } from '../basecommand' ;
8
7
@@ -37,7 +36,6 @@ export default class ScreenshotCommand extends BaseCommand<CommandArgs> {
37
36
}
38
37
39
38
async run ( context : Command . Context , args : CommandArgs ) {
40
- const response = await utilitiesScreenshot ( context , args ) ;
41
- return imageReply ( context , response ) ;
39
+ return Formatter . Commands . ToolsScreenshot . createMessage ( context , args ) ;
42
40
}
43
41
}
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import * as ToolsHash from './tools.hash';
36
36
import * as ToolsOCR from './tools.ocr' ;
37
37
import * as ToolsOCRTranslate from './tools.ocrtranslate' ;
38
38
import * as ToolsQrScan from './tools.qr.scan' ;
39
+ import * as ToolsScreenshot from './tools.screenshot' ;
39
40
import * as ToolsTranslate from './tools.translate' ;
40
41
41
42
export {
@@ -72,5 +73,6 @@ export {
72
73
ToolsOCR ,
73
74
ToolsOCRTranslate ,
74
75
ToolsQrScan ,
76
+ ToolsScreenshot ,
75
77
ToolsTranslate ,
76
78
} ;
Original file line number Diff line number Diff line change
1
+ import { Command , Interaction } from 'detritus-client' ;
2
+
3
+ import { utilitiesScreenshot } from '../../../api' ;
4
+ import { imageReply } from '../../../utils' ;
5
+
6
+
7
+ export interface CommandArgs {
8
+ url : string ,
9
+ }
10
+
11
+ export async function createMessage (
12
+ context : Command . Context | Interaction . InteractionContext ,
13
+ args : CommandArgs ,
14
+ ) {
15
+ const response = await utilitiesScreenshot ( context , args ) ;
16
+ return imageReply ( context , response ) ;
17
+ }
Original file line number Diff line number Diff line change @@ -711,6 +711,7 @@ export async function imageUrl(
711
711
return url ;
712
712
}
713
713
}
714
+ return null ;
714
715
}
715
716
}
716
717
@@ -841,9 +842,10 @@ export async function lastImageUrls(
841
842
const url = findImageUrlInMessages ( [ message ] ) ;
842
843
if ( url ) {
843
844
urls . add ( url ) ;
844
- found = true ;
845
845
}
846
846
}
847
+ // ignore this url no matter what
848
+ found = true ;
847
849
}
848
850
}
849
851
@@ -942,6 +944,7 @@ export async function imageUrlPositional(
942
944
return url ;
943
945
}
944
946
}
947
+ return null ;
945
948
}
946
949
}
947
950
You can’t perform that action at this time.
0 commit comments