Skip to content

Commit 1549af4

Browse files
committed
- Add .4chan, .regional, .aesthetics, .textwall. Update some commands
- Add `.4chan`, `.regional`, `.aesthetics`, `.textwall` - Update `.remind` -> Use given time text instead of generating one when responding initially - Remove `.urban random`, `.urban search` -> `.urban` now does both - Update Paginator to give files
1 parent b942cdb commit 1549af4

39 files changed

+729
-275
lines changed

package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@
1010
"dependencies": {
1111
"@sentry/node": "^6.4.1",
1212
"chrono-node": "^2.3.8",
13-
"detritus-client": "^0.17.0-beta.1",
13+
"detritus-client": "^0.17.0-beta.4",
1414
"emoji-aware": "^3.0.5",
1515
"juration": "^0.1.1",
1616
"moment": "^2.29.1",
1717
"moment-duration-format": "^2.3.2",
1818
"moment-timezone": "^0.5.32",
19-
"node-libcurl": "^2.3.3",
20-
"redis": "^3.1.2",
21-
"typescript": "^4.1.2"
19+
"redis": "^3.1.2"
2220
},
2321
"devDependencies": {
2422
"@types/moment-duration-format": "^2.2.2",
25-
"@types/node": "^15.6.1",
26-
"@types/node-fetch": "^2.5.10",
23+
"@types/node": "^17.0.27",
2724
"@types/redis": "^2.8.28"
2825
},
2926
"scripts": {

src/api/endpoints.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ export const Api = Object.freeze({
183183
REMINDER:
184184
'/reminders/:reminderId',
185185

186+
SEARCH_4CHAN:
187+
'/search/4chan',
188+
SEARCH_4CHAN_RANDOM:
189+
'/search/4chan/random',
186190
SEARCH_DUCKDUCKGO:
187191
'/search/duckduckgo',
188192
SEARCH_DUCKDUCKGO_IMAGES:

src/api/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,22 @@ export async function putUser(
861861
}
862862

863863

864+
export async function search4Chan(
865+
context: RequestContext,
866+
options: RestOptions.Search4Chan,
867+
) {
868+
return raw.search4Chan(context, options);
869+
}
870+
871+
872+
export async function search4ChanRandom(
873+
context: RequestContext,
874+
options: RestOptions.Search4ChanRandom,
875+
) {
876+
return raw.search4ChanRandom(context, options);
877+
}
878+
879+
864880
export async function searchDuckDuckGo(
865881
context: RequestContext,
866882
options: RestOptions.SearchDuckDuckGo,

src/api/raw.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,40 @@ export async function putUser(
17911791
}
17921792

17931793

1794+
export async function search4Chan(
1795+
context: RequestContext,
1796+
options: RestOptions.Search4Chan,
1797+
): Promise<RestResponsesRaw.Search4Chan> {
1798+
const query = {
1799+
board: options.board,
1800+
};
1801+
return request(context, {
1802+
query,
1803+
route: {
1804+
method: HTTPMethods.GET,
1805+
path: Api.SEARCH_4CHAN,
1806+
},
1807+
});
1808+
}
1809+
1810+
1811+
export async function search4ChanRandom(
1812+
context: RequestContext,
1813+
options: RestOptions.Search4ChanRandom,
1814+
): Promise<RestResponsesRaw.Search4Chan> {
1815+
const query = {
1816+
nsfw: options.nsfw,
1817+
};
1818+
return request(context, {
1819+
query,
1820+
route: {
1821+
method: HTTPMethods.GET,
1822+
path: Api.SEARCH_4CHAN_RANDOM,
1823+
},
1824+
});
1825+
}
1826+
1827+
17941828
export async function searchDuckDuckGo(
17951829
context: RequestContext,
17961830
options: RestOptions.SearchDuckDuckGo,

src/api/structures/googlesearchimageresult.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as moment from 'moment';
1+
import moment from 'moment';
22

33
import { Collections, Structures } from 'detritus-client';
44

src/api/structures/guildsettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as moment from 'moment';
1+
import moment from 'moment';
22

33
import { Collections, ShardClient, Structures } from 'detritus-client';
44
import { DiscordAbortCodes } from 'detritus-client/lib/constants';

src/api/types.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,14 @@ export namespace RestOptions {
319319
}
320320

321321

322+
export interface Search4Chan {
323+
board: string,
324+
}
325+
326+
export interface Search4ChanRandom {
327+
nsfw: boolean,
328+
}
329+
322330
export interface SearchDuckDuckGo {
323331
query: string,
324332
}
@@ -790,6 +798,76 @@ export namespace RestResponsesRaw {
790798
}
791799

792800

801+
export interface Search4ChanMedia {
802+
deleted: boolean,
803+
extension: string,
804+
height: number,
805+
md5: string,
806+
mobile_optimized: boolean,
807+
name: string,
808+
size: number,
809+
spoiler: boolean,
810+
spoiler_id: null | number,
811+
tag: null | string,
812+
url: string,
813+
width: number,
814+
}
815+
816+
export interface Search4ChanThread {
817+
closed: boolean,
818+
comment: string,
819+
created_at: number,
820+
created_at_text: string,
821+
edited_at: null | number,
822+
id: number,
823+
images: number,
824+
limited: {
825+
bump: boolean,
826+
images: boolean,
827+
},
828+
media: Search4ChanMedia | null,
829+
omitted: {
830+
images: number,
831+
posts: number,
832+
},
833+
posts: Array<{
834+
comment: string,
835+
created_at: number,
836+
created_at_text: string,
837+
id: number,
838+
media: Search4ChanMedia,
839+
reply_id: null | number,
840+
url: string,
841+
user: Search4ChanUser,
842+
}>,
843+
replies: number,
844+
sticky: boolean,
845+
sticky_cap: number | null,
846+
tail_size: number | null,
847+
title: string,
848+
unique_ips: number | null,
849+
url: string,
850+
url_semantic: string | null,
851+
user: Search4ChanUser,
852+
}
853+
854+
export interface Search4ChanUser {
855+
badge: null | string,
856+
country: null | {code: string, name: string},
857+
id: null | string,
858+
name: string,
859+
since4pass: null | number,
860+
trip: null | string,
861+
}
862+
863+
export interface Search4Chan {
864+
board: string,
865+
nsfw: boolean,
866+
threads: Array<Search4ChanThread>,
867+
url: string,
868+
}
869+
870+
793871
export interface SearchGoogle {
794872
cards: Array<SearchGoogleCard>,
795873
results: Array<SearchGoogleResult>,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import * as moment from 'moment';
1+
import moment from 'moment';
22
import 'moment-duration-format';

src/bootstrap/moment-timezone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as moment from 'moment';
1+
import moment from 'moment';
22
import 'moment-timezone';
33

44
moment.tz.setDefault('America/New_York');

src/commands/interactions/slash/reminder/create.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class ReminderCreateCommand extends BaseInteractionCommandOption {
3939
return Formatter.Commands.ReminderCreate.createMessage(context, {
4040
result: {
4141
content: args.content || args.when.content,
42+
contentTimestamp: args.when.contentTimestamp,
4243
end: args.when.end,
4344
start: args.when.start,
4445
},

0 commit comments

Comments
 (0)