Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Commit

Permalink
Release 36 events
Browse files Browse the repository at this point in the history
  • Loading branch information
devvyyxyz committed Aug 11, 2024
1 parent bea7f52 commit b28eb8a
Show file tree
Hide file tree
Showing 48 changed files with 663 additions and 0 deletions.
13 changes: 13 additions & 0 deletions events/audit_log_create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
name: "Audit Log Created",
nameSchemes: ["Store Audit Log As"],

initialize(client, data, run) {
client.on('guildAuditLogEntryCreate', (guild, auditLogEntry) => {
run([
auditLogEntry
], { guild })
})
}
};

7 changes: 7 additions & 0 deletions events/bot_ready.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
name: "Bot Ready",
nameSchemes: [],
initialize(client, data, run) {
run([], {})
}
}
9 changes: 9 additions & 0 deletions events/bulk_delete_messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
name: "Messages Bulk Delete",
nameSchemes: ["Store Deleted Messages List As"],
initialize(client, data, run) {
client.on('messageDeleteBulk', (messages) => {
run(messages, messages)
})
}
};
15 changes: 15 additions & 0 deletions events/button_interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
name: "Button Interaction",
nameSchemes: ["Store Button Interaction As", "Store Button Custom ID As", "Store Button Message As"],
initialize(client, data, run) {
client.on('interactionCreate', (interaction) => {
if (interaction.type != 3 || interaction.data.values) return;

run([
interaction,
interaction.data.customID,
interaction.message
], interaction)
})
}
};
12 changes: 12 additions & 0 deletions events/channel_create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
name: "Channel Create",
nameSchemes: ["Store Channel As"],

initialize(client, data, run) {
client.on('channelCreate', (channel) => {
run([
channel
], channel)
})
}
};
12 changes: 12 additions & 0 deletions events/channel_delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
name: "Channel Delete",
nameSchemes: ["Store Channel As"],

initialize(client, data, run) {
client.on('channelDelete', (channel) => {
run([
channel
], channel)
})
}
};
12 changes: 12 additions & 0 deletions events/channel_pins_update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
name: "Channel Pins Update",
nameSchemes: ["Store Channel As"],

initialize(client, data, run) {
client.on('channelPinsUpdate', (channel) => {
run([
channel
], channel)
})
}
};
12 changes: 12 additions & 0 deletions events/channel_update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
name: "Channel Update",
nameSchemes: ["Store Channel Before Update As", "Store Channel After Update As"],
initialize(client, data, run) {
client.on('channelUpdate', (updated, old) => {
run([
old,
updated
], updated)
})
}
};
17 changes: 17 additions & 0 deletions events/cron_job.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
name: "Cron Job",
nameSchemes: [`Cron String Input
<div class="hoverablez" onclick="require('electron').shell.openExternal('https://crontab.guru/')" style="width: 96%; margin: auto; padding-bottom: 12px; margin-bottom: -12px; border-radius: 8px;"><text style="margin-left:8px; padding: 3px;">Examples</text></div>`,
"Cron Timezone (Leave blank for default)"
],
preventStorage: [`Cron String Input
<div class="hoverablez" onclick="require('electron').shell.openExternal('https://crontab.guru/')" style="width: 96%; margin: auto; padding-bottom: 12px; margin-bottom: -12px; border-radius: 8px;"><text style="margin-left:8px; padding: 3px;">Examples</text></div>`,
"Cron Timezone (Leave blank for default)"
],
initialize(client, data, run) {
const cron = require('node-cron');
cron.schedule(data[0], () => {
run([], {});
}, data[1] ? {timezone: data[1]} : null);
}
};
16 changes: 16 additions & 0 deletions events/dropdown_interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
name: "Select Menu Interaction",
nameSchemes: ["Store Menu Interaction As", "Store Menu Custom ID As", "Store Choices Values List As", "Store Interaction Message As"],
initialize(client, data, run) {
client.on('interactionCreate', (interaction) => {
if (interaction.type != 3 || !interaction.data.values) return;

run([
interaction,
interaction.data.customID,
interaction.data.values.raw,
interaction.message
], interaction)
})
}
};
11 changes: 11 additions & 0 deletions events/guildCreate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Bot Join Server",
nameSchemes: ["Store Server As"],
initialize(client, data, run) {
client.on('guildCreate', (guild) => {
run([
guild
], {guild})
})
}
};
11 changes: 11 additions & 0 deletions events/guildLeave.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Bot Leave Server",
nameSchemes: ["Store Server As"],
initialize(client, data, run) {
client.on('guildDelete', (guild) => {
run([
guild
], {guild})
})
}
};
16 changes: 16 additions & 0 deletions events/guild_ban_add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
name: "Member Ban",
nameSchemes: ["Store Guild As", "Store Member As"],
initialize(client, data, run) {
client.on('guildBanAdd', async (guild, member) => {
if (!guild.createdAt) {
guild = await client.rest.guilds.get(guild.id)
}

run([
member.guild,
member
], { guild })
})
}
};
16 changes: 16 additions & 0 deletions events/guild_ban_remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
name: "Member Unban",
nameSchemes: ["Store Guild As", "Store Member As"],
initialize(client, data, run) {
client.on('guildBanRemove', async (guild, member) => {
if (!guild.createdAt) {
guild = await client.rest.guilds.get(guild.id)
}

run([
member.guild,
member
], member)
})
}
};
11 changes: 11 additions & 0 deletions events/invite_create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Invite Create",
nameSchemes: ["Store Invite As"],
initialize(client, data, run) {
client.on('inviteCreate', (invite) => {
run([
invite
], invite)
})
}
};
11 changes: 11 additions & 0 deletions events/invite_delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Invite Delete",
nameSchemes: ["Store Invite As"],
initialize(client, data, run) {
client.on('inviteDelete', (invite) => {
run([
invite
], invite)
})
}
};
19 changes: 19 additions & 0 deletions events/member_boost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { Client } = require("oceanic.js");

module.exports = {
name: "Member Boosted Server",
nameSchemes: ["Store Member As", "Store Server As"],

/**
* @param {Client} client
* @param {*} data
* @param {*} run
*/
initialize(client, data, run) {
client.on('guildMemberUpdate', async (member, oldMember) => {
if (!oldMember.premiumSince && member.premiumSince) {
run([member, member.guild], member);
}
});
}
};
11 changes: 11 additions & 0 deletions events/member_join_guild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Member Join Server",
nameSchemes: ["Store Member As"],
async initialize(client, data, run) {
client.on('guildMemberAdd', async (member) => {
run([
member
], member)
})
}
};
11 changes: 11 additions & 0 deletions events/member_leave_guild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Member Leave Server",
nameSchemes: ["Store Member As"],
async initialize(client, data, run) {
client.on('guildMemberRemove', async (member) => {
run([
member
], member)
})
}
};
18 changes: 18 additions & 0 deletions events/member_role_add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
name: "Member Role Add",
nameSchemes: ["Store Member As", "Store Role As"],
initialize(client, data, run) {
client.on('guildMemberUpdate', (member, oldMember) => {
if (oldMember && member.roles.length > oldMember.roles.length) {
let roleID = member.roles.find(r => !oldMember.roles.includes(r));
let role = member.guild.roles.get(roleID);

run([
member,
role
], { guild: member.guild })
}
})
}
};

18 changes: 18 additions & 0 deletions events/member_role_remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
name: "Member Role Remove",
nameSchemes: ["Store Member As", "Store Role As"],
initialize(client, data, run) {
client.on('guildMemberUpdate', (member, oldMember) => {
if (oldMember && member.roles.length < oldMember.roles.length) {
let roleID = oldMember.roles.find(r => !member.roles.includes(r));
let role = member.guild.roles.get(roleID);

run([
member,
role
], { guild: member.guild })
}
})
}
};

17 changes: 17 additions & 0 deletions events/member_switch_channel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
name: "Member Move Voice Channel",
nameSchemes: ["Store Member As", "Store Old Channel As", "Store New Channel As"],
async initialize(client, data, run) {
client.on('voiceChannelSwitch', async (member, oldChannel, channel) => {
let channel1 = client.getChannel(channel.id) || (await client.rest.channels.get(channel.id));
let channel2 = client.getChannel(oldChannel.id) || (await client.rest.channels.get(oldChannel.id));
let user = member.user;
user.member = member;
run([
user,
channel1,
channel2
], {guild: member.guild})
})
}
}
22 changes: 22 additions & 0 deletions events/member_update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { Client } = require("oceanic.js");

module.exports = {
name: "Member Update",
nameSchemes: ["Store Member As", "Store Old Member As"],

/**
* @param {Client} client
* @param {*} data
* @param {*} run
*/
initialize(client, data, run) {
client.on('guildMemberUpdate', async (member, oldJSONMember) => {
const {Member} = require('oceanic.js');
let old = new Member(oldJSONMember);
run([
member,
old
], member)
})
}
};
13 changes: 13 additions & 0 deletions events/member_voice_update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
name: "Member Voice Update",
nameSchemes: ["Store Current Member As"],
async initialize(client, data, run) {
client.on('voiceStateUpdate', (member) => {
let user = member.user;
user.member = member;
run([
user
], {guild: member.guild})
})
}
}
11 changes: 11 additions & 0 deletions events/message_create.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Message Create",
nameSchemes: ["Store Message As"],
initialize(client, data, run) {
client.on('messageCreate', (message) => {
run([
message
], message)
})
}
};
11 changes: 11 additions & 0 deletions events/message_delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
name: "Message Delete",
nameSchemes: ["Store Message As"],
initialize(client, data, run) {
client.on('messageDelete', async (message) => {
run([
message
], message)
})
}
};
Loading

0 comments on commit b28eb8a

Please sign in to comment.