Skip to content

Commit e501815

Browse files
committed
Add ht!randomteams
1 parent 68ae6e5 commit e501815

3 files changed

Lines changed: 98 additions & 1 deletion

File tree

src/commands/characters/character.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Note: this command supports fuzzy search.`,
173173
return -1
174174
else return a.name.localeCompare(b.name)
175175
})
176-
.map((char) => `**${char.name}**: ${this.getBasicInfo(char)}`)
176+
.map((char) => `**${data.emoji(char.name, true)}**: ${this.getBasicInfo(char)}`)
177177

178178
const pages: string[] = []
179179
let paging = "", c = 0
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { CommandInteraction, Message } from "discord.js"
2+
3+
import Command from "../../utils/Command"
4+
import client from "../../main"
5+
import { sendMessage } from "../../utils/Utils"
6+
import { CommandSource, SendMessage } from "../../utils/Types"
7+
8+
export default class RandomTeams extends Command {
9+
constructor(name: string) {
10+
super({
11+
name,
12+
category: "Character",
13+
help: "Generate random teams.",
14+
usage: "randomteam",
15+
aliases: ["randomteam", "rt", "rts", "ra", "randomabyss", "rng"],
16+
options: []
17+
})
18+
}
19+
20+
async runInteraction(source: CommandInteraction): Promise<SendMessage | undefined> {
21+
return this.run(source)
22+
23+
}
24+
async runMessage(source: Message): Promise<SendMessage | undefined> {
25+
return this.run(source)
26+
}
27+
28+
async run(source: CommandSource): Promise<SendMessage | undefined> {
29+
const { data } = client
30+
const chars = this.shuffle(data.getReleasedCharacters().map(x => x.name))
31+
32+
return sendMessage(source, `**Random teams**:
33+
**Team 1**: ${chars.slice(0, 4).map(x => data.emoji(x, true)).join(", ")}
34+
**Team 2**: ${chars.slice(4, 8).map(x => data.emoji(x, true)).join(", ")}
35+
36+
Replacement characters in case you're missing any: ${chars.slice(8, 14).map(x => data.emoji(x, true)).join(", ")}`)
37+
}
38+
39+
shuffle(input: string[]): string[] {
40+
for (let i = input.length; 0 !== i; i--) {
41+
const rand = Math.floor(Math.random() * (i+1))
42+
43+
const tmp = input[i]
44+
input[i] = input[rand]
45+
input[rand] = tmp
46+
}
47+
48+
return input
49+
}
50+
}

src/data/emojis.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,53 @@
371371
"Maguu Kenki: Mask of Terror": "<:Maguu_Kenki_Mask_of_Terror:927641062602846208>",
372372
"The Rock": "<:The_Rock:927680089955663882>",
373373

374+
"Albedo": "<:Albedo:929382836400717916>",
375+
"Aloy": "<:Aloy:929382836509765693>",
376+
"Amber": "<:Amber:929382997973692476>",
377+
"Arataki Itto": "<:Arataki_Itto:929382997378105385>",
378+
"Barbara": "<:Barbara:929382999924027432>",
379+
"Beidou": "<:Beidou:929383000171479040>",
380+
"Bennett": "<:Bennett:929383000326688819>",
381+
"Chongyun": "<:Chongyun:929382999701745694>",
382+
"Diluc": "<:Diluc:929383000368619541>",
383+
"Diona": "<:Diona:929382999970185257>",
384+
"Eula": "<:Eula:929383000679018536>",
385+
"Fischl": "<:Fischl:929383000574132274>",
386+
"Ganyu": "<:Ganyu:929383000792248320>",
387+
"Gorou": "<:Gorou:929383001085849701>",
388+
"Hu Tao": "<:Hu_Tao:929383000691597312>",
389+
"Jean": "<:Jean:929383000217632838>",
390+
"Kaedehara Kazuha": "<:Kaedehara_Kazuha:929383000167284786>",
391+
"Kaeya": "<:Kaeya:929383000456712282>",
392+
"Kamisato Ayaka": "<:Kamisato_Ayaka:929382999835963443>",
393+
"Keqing": "<:Keqing:929383000729354250>",
394+
"Klee": "<:Klee:929383000393781310>",
395+
"Kujou Sara": "<:Kujou_Sara:929383000205045800>",
396+
"Lisa": "<:Lisa:929383000637063288>",
397+
"Mona": "<:Mona:929383000708378705>",
398+
"Ningguang": "<:Ningguang:929383001060675604>",
399+
"Noelle": "<:Noelle:929383001111015475>",
400+
"Qiqi": "<:Qiqi:929383159185936384>",
401+
"Raiden Shogun": "<:Raiden_Shogun:929383160624578640>",
402+
"Razor": "<:Razor:929383160502960128>",
403+
"Rosaria": "<:Rosaria:929383160301649951>",
404+
"Sangonomiya Kokomi": "<:Sangonomiya_Kokomi:929383160108687372>",
405+
"Sayu": "<:Sayu:929383160775573534>",
406+
"Shenhe": "<:Shenhe:929383160557477928>",
407+
"Sucrose": "<:Sucrose:929383160721051658>",
408+
"Tartaglia": "<:Tartaglia:929383160788176906>",
409+
"Thoma": "<:Thoma:929383160708481024>",
410+
"Traveler": "<:Traveler:929383160616210502>",
411+
"Venti": "<:Venti:929383160612024370>",
412+
"Xiangling": "<:Xiangling:929383160557498408>",
413+
"Xiao": "<:Xiao:929383160603619488>",
414+
"Xingqiu": "<:Xingqiu:929383160024813589>",
415+
"Xinyan": "<:Xinyan:929383161165643806>",
416+
"Yanfei": "<:Yanfei:929383160918183956>",
417+
"Yoimiya": "<:Yoimiya:929383160880431144>",
418+
"Yun Jin": "<:Yun_Jin:929383160272285767>",
419+
"Zhongli": "<:Zhongli:929383160670748762>",
420+
374421
"Mora": "<:Mora:827985024745603111>",
375422

376423
"Wanderer's Advice": "<:Wanderers_Advice:829496144681631754>",

0 commit comments

Comments
 (0)