Skip to content

Commit 8ea7b10

Browse files
committed
add bluearchive and anilist
1 parent b1a478a commit 8ea7b10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+321
-98
lines changed

.env.example

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#Tokens
22
TOKEN=
3-
TEST_TOKEN=
43
CLIENT_ID=
54
CLIENT_SECRET=
6-
TEST_CLIENT_ID=
7-
TEST_CLIENT_SECRET=
85
OWNER_ID=
96
OWNER_SERVER=
107

8+
#Testing
9+
TESTING=no
10+
TEST_TOKEN=
11+
TEST_CLIENT_ID=
12+
TEST_CLIENT_SECRET=
13+
1114
#Database credentials
1215
PG_HOST=
1316
PG_USER=

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ COPY . .
1212
EXPOSE 4000
1313
COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf
1414

15-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]
15+
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]

assets/images/default.jpg

-147 KB
Binary file not shown.

assets/images/rankBar.jpg

-139 Bytes
Binary file not shown.

assets/images/screenshot.png

-418 KB
Binary file not shown.

assets/images/welcomeBG.gif

-328 KB
Binary file not shown.

assets/json/responses.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
"image": {
2626
"bleh": "https://i.ytimg.com/vi/Gn4ah6kAmZo/maxresdefault.jpg",
27-
"smug": "https://pbs.twimg.com/media/CpfL-c3WEAE1Na_.jpg",
28-
"bye": "https://i.imgur.com/2CrEDAD.gif"
27+
"smug": "https://pbs.twimg.com/media/CpfL-c3WEAE1Na_.jpg"
2928
}
3029
}

commands/anime/kitsune.ts

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default class Kitsune extends Command {
3434
const perms = new Permission(discord, message)
3535
const embeds = new Embeds(discord, message)
3636
const neko = new nekoClient()
37-
if (!perms.checkNSFW()) return
3837

3938
let image: NekoRequestResults
4039
let title: string

commands/anime/neko.ts

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export default class Neko extends Command {
4747
const message = this.message
4848
const embeds = new Embeds(discord, message)
4949
const perms = new Permission(discord, message)
50-
if (!perms.checkNSFW()) return
5150

5251
if (args[1]?.toLowerCase() === "gif") {
5352
const neko = new nekoClient()

commands/anime/stockings.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Stockings extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const perms = new Permission(discord, message)
3737
const pixiv = new PixivApi(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("stockings", 20)
4140
return embeds.createReactionEmbed(pixivArray, true, true)

commands/booru/danbooru.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export default class Danbooru extends Command {
3131
random: "none",
3232
cooldown: 20,
3333
defer: true,
34-
nsfw: true,
35-
subcommandEnabled: false
34+
subcommandEnabled: true
3635
})
3736
const tagOption = new SlashCommandOption()
3837
.setType("string")

commands/booru/gelbooru.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export default class Gelbooru extends Command {
3030
random: "none",
3131
cooldown: 20,
3232
defer: true,
33-
nsfw: true,
34-
subcommandEnabled: false
33+
subcommandEnabled: true
3534
})
3635
const tagOption = new SlashCommandOption()
3736
.setType("string")

commands/booru/konachan.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export default class Konachan extends Command {
3131
random: "none",
3232
cooldown: 20,
3333
defer: true,
34-
nsfw: true,
35-
subcommandEnabled: false
34+
subcommandEnabled: true
3635
})
3736
const tagOption = new SlashCommandOption()
3837
.setType("string")

commands/booru/yandere.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export default class Yandere extends Command {
3131
random: "none",
3232
cooldown: 20,
3333
defer: true,
34-
nsfw: true,
35-
subcommandEnabled: false
34+
subcommandEnabled: true
3635
})
3736
const tagOption = new SlashCommandOption()
3837
.setType("string")

commands/config/oauth2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default class Oauth2 extends Command {
6060
states.push(state)
6161
await SQLQuery.redisSet("state", JSON.stringify(states))
6262

63-
const redirect = config.testing ? config.oauth2Testing : config.oauth2
63+
const redirect = process.env.TESTING === "yes" ? config.oauth2Testing : config.oauth2
6464
const url = `https://discord.com/api/oauth2/authorize?client_id=${discord.user!.id}&redirect_uri=${encodeURIComponent(redirect)}&state=${state}&response_type=code&scope=email%20connections%20guilds%20identify`
6565
const oauth2Embed = embeds.createEmbed()
6666
oauth2Embed

commands/fun/pickle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {Permission} from "../../structures/Permission"
77
export default class Pickle extends Command {
88
constructor(discord: Kisaragi, message: Message) {
99
super(discord, message, {
10-
description: `Posts your pickle size ${discord.getEmoji("tohruSmug")}`,
10+
description: `Posts your pickle size`,
1111
help:
1212
`
1313
_Note:_ The sizes are seeded and won't change ${discord.getEmoji("tohruSmug")}

commands/game/azurlane.ts

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export default class AzurLane extends Command {
7474
const message = this.message
7575
const embeds = new Embeds(discord, message)
7676
const perms = new Permission(discord, message)
77-
if (!perms.checkNSFW()) return
7877
let query = Functions.combineArgs(args, 1).trim().replace(/ +/g, "_")
7978
if (!query) {
8079
query = this.defaults[Math.floor(Math.random()*this.defaults.length)].trim().replace(/ +/g, "_")

commands/game/bluearchive.ts

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import {Message, AttachmentBuilder} from "discord.js"
2+
import {SlashCommandSubcommand, SlashCommandOption} from "../../structures/SlashCommandOption"
3+
import {Command} from "../../structures/Command"
4+
import {Embeds} from "../../structures/Embeds"
5+
import {Functions} from "../../structures/Functions"
6+
import {Kisaragi} from "../../structures/Kisaragi"
7+
import {Permission} from "./../../structures/Permission"
8+
import {students} from "blue-archive"
9+
import path from "path"
10+
import fs from "fs"
11+
12+
export default class BlueArchive extends Command {
13+
private readonly defaults = [
14+
"Shiroko", "Alona", "Hina", "Hoshino", "Hifumi", "Koharu", "Serika", "Chise",
15+
"Hikari", "Nozomi", "Yuuka", "Serina", "Shizuko", "Miyu", "Mari", "Iroha", "Momoi",
16+
"Midori", "Plana", "Hanako", "Azusa", "Shun", "Fuuka", "Nagisa", "Seia", "Yuzu",
17+
"Toki", "Mika", "Aris", "Miyako"
18+
]
19+
constructor(discord: Kisaragi, message: Message) {
20+
super(discord, message, {
21+
description: "Searches for a blue archive character.",
22+
help:
23+
`
24+
\`bluearchive\` - Gets some picked characters.
25+
\`bluearchive character\` - Gets information on the character.
26+
`,
27+
examples:
28+
`
29+
\`=>bluearchive shiroko\`
30+
\`=>bluearchive hoshino\`
31+
`,
32+
aliases: ["ba"],
33+
random: "none",
34+
cooldown: 10,
35+
subcommandEnabled: true
36+
})
37+
const characterOption = new SlashCommandOption()
38+
.setType("string")
39+
.setName("character")
40+
.setDescription("Character to search for.")
41+
42+
this.subcommand = new SlashCommandSubcommand()
43+
.setName(this.constructor.name.toLowerCase())
44+
.setDescription(this.options.description)
45+
.addOption(characterOption)
46+
}
47+
48+
public run = async (args: string[]) => {
49+
const discord = this.discord
50+
const message = this.message
51+
const embeds = new Embeds(discord, message)
52+
const perms = new Permission(discord, message)
53+
if (discord.checkMuted(message)) if (!perms.checkNSFW()) return
54+
let query = Functions.combineArgs(args, 1).trim().replace(/ +/g, "-")
55+
if (!query) {
56+
query = this.defaults[Math.floor(Math.random()*this.defaults.length)].trim()
57+
}
58+
const studentCN = students.queryByName(query)?.[0]
59+
if (!studentCN) {
60+
return this.invalidQuery(embeds.createEmbed()
61+
.setAuthor({name: "bluearchive", iconURL: "https://kisaragi.moe/assets/embed/bluearchive.png"})
62+
.setTitle(`**Blue Archive Search** ${discord.getEmoji("midoriHug")}`))
63+
}
64+
const student = students.getById(studentCN.Id, "en")
65+
66+
const iconPath = path.join(__dirname, `../../../node_modules/blue-archive/assets/icons/${student.PathName}.png`)
67+
const imagePath = path.join(__dirname, `../../../node_modules/blue-archive/assets/portraits/${student.DevName}.webp`)
68+
69+
let attachments = [] as AttachmentBuilder[]
70+
if (fs.existsSync(iconPath)) {
71+
const iconAttachment = new AttachmentBuilder(fs.readFileSync(iconPath), {name: "thumbnail.png"})
72+
attachments.push(iconAttachment)
73+
}
74+
if (fs.existsSync(imagePath)) {
75+
const imageAttachment = new AttachmentBuilder(fs.readFileSync(imagePath), {name: "image.png"})
76+
attachments.push(imageAttachment)
77+
}
78+
79+
const blueArchiveEmbed = embeds.createEmbed()
80+
blueArchiveEmbed
81+
.setAuthor({name: "bluearchive", iconURL: "https://kisaragi.moe/assets/embed/bluearchive.png"})
82+
.setTitle(`**Blue Archive Search** ${discord.getEmoji("midoriHug")}`)
83+
.setURL(`https://bluearchive.fandom.com/wiki/${student.Name}`)
84+
.setThumbnail("attachment://thumbnail.png")
85+
.setImage("attachment://image.png")
86+
.setDescription(
87+
`${discord.getEmoji("star")}_Character:_ **${student.FamilyName} ${student.Name}**\n` +
88+
`${discord.getEmoji("star")}_School:_ **${student.School}**\n` +
89+
`${discord.getEmoji("star")}_Club:_ **${student.Club}**\n` +
90+
`${discord.getEmoji("star")}_Star Grade:_ **${student.StarGrade}${discord.getEmoji("starYellow")}**\n` +
91+
`${discord.getEmoji("star")}_Age:_ **${student.CharacterAge}**\n` +
92+
`${discord.getEmoji("star")}_Height:_ **${student.CharHeightImperial}**\n` +
93+
`${discord.getEmoji("star")}_Birthday:_ **${student.Birthday}**\n` +
94+
`${discord.getEmoji("star")}_Hobby:_ ${student.Hobby}\n` +
95+
`${discord.getEmoji("star")}_Description:_ ${student.ProfileIntroduction}\n`
96+
)
97+
return this.reply(blueArchiveEmbed, attachments)
98+
}
99+
}

commands/game/genshin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ export default class Genshin extends Command {
100100
)
101101
return this.reply(genshinEmbed)
102102
}
103-
}
103+
}

commands/game/kancolle.ts

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export default class Kancolle extends Command {
4949
const message = this.message
5050
const embeds = new Embeds(discord, message)
5151
const perms = new Permission(discord, message)
52-
if (!perms.checkNSFW()) return
5352
const headers = {
5453
"referer": "https://kancolle.fandom.com/",
5554
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0"

commands/twitter/twitteroauth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class TwitterOauth extends Command {
5454
return this.reply(oauth2Embed)
5555
}
5656

57-
const callback = config.testing ? config.twitterRedirectTesting : config.twitterRedirect
57+
const callback = process.env.TESTING === "yes" ? config.twitterRedirectTesting : config.twitterRedirect
5858
const oauth = new OAuth(
5959
"https://api.twitter.com/oauth/request_token",
6060
"https://api.twitter.com/oauth/access_token",

commands/waifu/aqua.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Aqua extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("aqua", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/chino.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Chino extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("chino", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/emilia.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Emilia extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("emilia", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/felt.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Felt extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("felt", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/gab.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Gab extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("gabriel", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/hibiki.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Hibiki extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("hibiki", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/kanna.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Kanna extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("kanna", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/karen.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Karen extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("karen", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/kisaragi.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class KisaragiCommand extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("kisaragi", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/klee.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Klee extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("klee", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/laffey.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Laffey extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("laffey", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/maika.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Maika extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("maika", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/megumin.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Megumin extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("megumin", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/miku.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Miku extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("miku", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/raphi.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Raphi extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("raphi", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/sagiri.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Sagiri extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("sagiri", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/satania.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Satania extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("satania", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

commands/waifu/sistine.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default class Sistine extends Command {
3535
const embeds = new Embeds(discord, message)
3636
const pixiv = new PixivApi(discord, message)
3737
const perms = new Permission(discord, message)
38-
if (!perms.checkNSFW()) return
3938

4039
const pixivArray = await pixiv.animeEndpoint("sistine", 10)
4140
embeds.createReactionEmbed(pixivArray, true, true)

0 commit comments

Comments
 (0)