Skip to content

Commit

Permalink
last resort.
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Sep 23, 2024
1 parent 1eed905 commit 5900263
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
5 changes: 2 additions & 3 deletions aurora/common/resident.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,10 @@ class ResidentHelper extends BaseHelper {
}

addCommonFields() {
if (!this.apiResident) this.addDatesFromDB()
else {
if (this.apiResident) {
this.addBalance(this.apiResident?.stats?.balance)
this.addDatesFromAPI()
}
} else this.addDatesFromDB()

this.addLinkedAcc()
}
Expand Down
24 changes: 12 additions & 12 deletions aurora/slashcommands/alliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ import AllianceModal from '../../bot/objects/AllianceModal.js'
import type { SlashCommand } from "../../bot/types.js"

const editingChannels = ["971408026516979813"]
const editorRole = "966359842417705020"

const checkEditor = async (interaction: ChatInputCommandInteraction) => {
const author = interaction.member as GuildMember

const isEditor = editingChannels.includes(interaction.channelId) &&
author.roles.cache.has('966359842417705020')

if (!botDevs.includes(author.id) && !isEditor) {
return interaction.reply({embeds: [new EmbedBuilder()
.setTitle("That command is for editors only!\nIf you are an editor, you're probably in the wrong channel.")
.setAuthor({ name: author.user.username, iconURL: author.displayAvatarURL() })
.setColor(Colors.Red)
.setTimestamp()
]}).then(m => setTimeout(() => m.delete(), 10000)).catch(() => {})
}
const isEditor = editingChannels.includes(interaction.channelId) && author.roles.cache.has(editorRole)

if (!botDevs.includes(author.id) && !isEditor) interaction.reply({embeds: [new EmbedBuilder()
.setTitle("That command is for editors only!\nIf you are an editor, you're probably in the wrong channel.")
.setColor(Colors.Red)
.setTimestamp()
.setAuthor({
name: author.user.username,
iconURL: author.displayAvatarURL()
})
]}).then(m => setTimeout(() => m.delete(), 10000)).catch(() => {})
}

const getAlliance = async (options: CommandInteractionOptionResolver, skipCache = true) => {
Expand Down
21 changes: 20 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const client: ExtendedClient = new Client({
client.login(process.env.DISCORD_BOT_TOKEN).then(token => {
client.slashCommands = new Collection()
client.auroraCommands = new Collection()
//client['novaCommands'] = new Collection()

console.log(`Logged into Discord.\nToken: ${token}`)
}).catch(console.error)
Expand Down Expand Up @@ -95,4 +94,24 @@ process.on('unhandledRejection', (err: ErrorWithCode) => console.error('Unhandle
process.on('uncaughtException', (err: ErrorWithCode) => {
if (err.code != 50013) console.error('Uncaught Exception!\n', err)
})
//#endregion

//#region ANTI-RETARD PING SPAM
const replies = [
"no.", "be fucking patient moron", "I DO NOT CARE", "Do it again, I dare you.",
"^ this guy likes boys", "you have severe brain damage.", "shutup and smd",
"You have been automatically reported to Discord.", "Please hold. Currently doing your mother."
]

client.on('messageCreate', async ({ member, guild, content, mentions, reply }) => {
if (guild.id != "966271635894190090") return // Ensure toolkit discord
if (member.roles.cache.has("966359842417705020")) return // Ensure not editor

// Check regular content, if somehow mention was bypassed.
const isPing = content.includes("@Owen3H") || content.includes("<@263377802647175170>")
if (isPing || mentions.has("263377802647175170")) {
await reply(replies[Math.floor(Math.random() * replies.length)])
member.timeout(10 * 60 * 1000)
}
})
//#endregion

0 comments on commit 5900263

Please sign in to comment.