-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f12586e
commit 8b51315
Showing
11 changed files
with
137 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
import Discord from "discord.js"; | ||
import Client from "../struct/Client.js"; | ||
import { noop } from "@buildtheearth/bot-utils"; | ||
|
||
export default async function languageDropdown(client: Client, interaction: Discord.StringSelectMenuInteraction): Promise<any> { | ||
const roles = interaction.values.map((e) => e.replace("language.", "")) | ||
|
||
const languageRoles = [ | ||
"696121533663281205", | ||
"696123149606977628", | ||
"696123325344251995", | ||
"696123331673587742", | ||
"696123338774544475", | ||
"696123339063820329", | ||
"696123339990892584", | ||
"696123340468781136", | ||
"696139193029492757", | ||
] | ||
|
||
const member = await client.customGuilds.main().members.fetch(interaction.user).catch(noop) | ||
|
||
if (!member) return await interaction.reply("Unknown Error") | ||
|
||
const currRoles = member.roles.cache.filter((e) => languageRoles.includes(e.id)).map((e) => e.id) | ||
|
||
for (const role of currRoles) { | ||
if (!roles.includes(role)) await member.roles.remove(role) | ||
} | ||
|
||
for (const role of roles) { | ||
if (!currRoles.includes(role)) await member.roles.add(role) | ||
} | ||
|
||
return await interaction.reply({content: "Roles have been given!", ephemeral: true}) | ||
} | ||
import Discord from "discord.js" | ||
import Client from "../struct/Client.js" | ||
import { noop } from "@buildtheearth/bot-utils" | ||
|
||
export default async function languageDropdown( | ||
client: Client, | ||
interaction: Discord.StringSelectMenuInteraction | ||
): Promise<any> { | ||
const roles = interaction.values.map(e => e.replace("language.", "")) | ||
|
||
const languageRoles = [ | ||
"696121533663281205", | ||
"696123149606977628", | ||
"696123325344251995", | ||
"696123331673587742", | ||
"696123338774544475", | ||
"696123339063820329", | ||
"696123339990892584", | ||
"696123340468781136", | ||
"696139193029492757" | ||
] | ||
|
||
const member = await client.customGuilds | ||
.main() | ||
.members.fetch(interaction.user) | ||
.catch(noop) | ||
|
||
if (!member) return await interaction.reply("Unknown Error") | ||
|
||
const currRoles = member.roles.cache | ||
.filter(e => languageRoles.includes(e.id)) | ||
.map(e => e.id) | ||
|
||
for (const role of currRoles) { | ||
if (!roles.includes(role)) await member.roles.remove(role) | ||
} | ||
|
||
for (const role of roles) { | ||
if (!currRoles.includes(role)) await member.roles.add(role) | ||
} | ||
|
||
return await interaction.reply({ content: "Roles have been given!", ephemeral: true }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
import { noop } from "@buildtheearth/bot-utils" | ||
import Client from "../struct/Client.js" | ||
import Discord from "discord.js" | ||
|
||
export default async function teamMenu(client: Client, interaction: Discord.ButtonInteraction): Promise<any> { | ||
const continent = interaction.customId | ||
|
||
const validContinents = [ | ||
"info.teams.NA", | ||
"info.teams.LA", | ||
"info.teams.EU", | ||
"info.teams.AF", | ||
"info.teams.AS", | ||
"info.teams.OC", | ||
"info.teams.OT" | ||
] | ||
|
||
if (!validContinents.includes(continent)) return await interaction.reply({content: "Invalid Region", ephemeral: true}).catch(noop) | ||
|
||
const data = client.assets.getAsset(continent) | ||
|
||
if (!data) return await interaction.reply({content: "Invalid Region", ephemeral: true}).catch(noop) | ||
|
||
return await interaction.reply(data).catch(noop) | ||
|
||
} | ||
import { noop } from "@buildtheearth/bot-utils" | ||
import Client from "../struct/Client.js" | ||
import Discord from "discord.js" | ||
|
||
export default async function teamMenu( | ||
client: Client, | ||
interaction: Discord.ButtonInteraction | ||
): Promise<any> { | ||
const continent = interaction.customId | ||
|
||
const validContinents = [ | ||
"info.teams.NA", | ||
"info.teams.LA", | ||
"info.teams.EU", | ||
"info.teams.AF", | ||
"info.teams.AS", | ||
"info.teams.OC", | ||
"info.teams.OT" | ||
] | ||
|
||
if (!validContinents.includes(continent)) | ||
return await interaction | ||
.reply({ content: "Invalid Region", ephemeral: true }) | ||
.catch(noop) | ||
|
||
const data = client.assets.getAsset(continent) | ||
|
||
if (!data) | ||
return await interaction | ||
.reply({ content: "Invalid Region", ephemeral: true }) | ||
.catch(noop) | ||
|
||
return await interaction.reply(data).catch(noop) | ||
} |
Oops, something went wrong.