mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-05-14 22:26:54 +00:00
Added invite functionality and changed the EJS
This commit is contained in:
+39
-5
@@ -1,9 +1,43 @@
|
||||
const Guild = require("../structures/guilds/guild");
|
||||
const { Client } = require("../structures/types");
|
||||
import Guild from "../structures/guilds/Guild.js";
|
||||
import { guildRole, newGuildRoleObj } from "../structures/guilds/guildRoles.js";
|
||||
import { Client } from "../structures/types.js";
|
||||
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
module.exports = /** @param {Client} c */ async (c) => {
|
||||
c.guilds.forEach(/** @param {Guild} guild */ (guild) => {
|
||||
console.log(guild);
|
||||
/** @param {Client} c */
|
||||
export default async function temp(c) {
|
||||
// c.guilds.forEach(/** @param {Guild} guild */ (guild) => {
|
||||
// console.log(guild);
|
||||
// });
|
||||
|
||||
const guild = c.guilds.get("930148608400035860");
|
||||
const member = guild.members.get("720349017829015633");
|
||||
console.log(member.roles.cache);
|
||||
|
||||
if (!member.roles.has('946610800418762792')) {
|
||||
const response = await member.roles.add('946610800418762792');
|
||||
// console.log(response);
|
||||
}
|
||||
|
||||
const newRole = new newGuildRoleObj({
|
||||
name: 'newrole'
|
||||
});
|
||||
|
||||
if (!guild.roles.findByName(newRole.name)) {
|
||||
const response2 = await guild.roles.create(newRole);
|
||||
// console.log(response2);
|
||||
await delay(2000);
|
||||
|
||||
const response3 = await guild.roles.delete(response);
|
||||
// console.log(response3);
|
||||
}
|
||||
|
||||
const invites = await guild.getInvites();
|
||||
await delay(1000);
|
||||
|
||||
//Delete any invite that's gonna expire
|
||||
for (const invite of invites) {
|
||||
if (invite.max_age != 0) {
|
||||
console.log(await invite.delete());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
const { Interaction } = require('../structures/types');
|
||||
import { Interaction } from '../structures/types.js';
|
||||
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
module.exports = /** @param {Interaction} interaction */ async (interaction) => {
|
||||
/** @param {Interaction} interaction */
|
||||
export default async (interaction) => {
|
||||
interaction.reply({content: "HELLO WORLD", ephemeral: true});
|
||||
await delay(3000);
|
||||
interaction.update({content: "NOOOOOOOOOOOOOOOOOO"});
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
const {message, Embed, messageChannelTypes} = require('../structures/types');
|
||||
import {message, Embed, messageChannelTypes} from '../structures/types.js';
|
||||
|
||||
module.exports = /** @param {message} message */ async (message) => {
|
||||
|
||||
/** @param {message} message */
|
||||
export default async (message) => {
|
||||
if (message.type == messageChannelTypes.DM) {
|
||||
const embd = new Embed()
|
||||
.setTitle("hello world")
|
||||
@@ -17,5 +19,7 @@ module.exports = /** @param {message} message */ async (message) => {
|
||||
|
||||
const response3 = await response.edit("KAT");
|
||||
console.log(response3);
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
const { Client, gateWayIntents, message, Interaction } = require('../structures/types');
|
||||
const { bottoken } = require('../config.json');
|
||||
|
||||
import { Client, gateWayIntents, message, Interaction } from '../structures/types.js';
|
||||
import config from '../config.json' assert { type: 'json' };
|
||||
const { bottoken } = config;
|
||||
|
||||
var c = new Client({
|
||||
intents: [
|
||||
@@ -23,17 +23,17 @@ c.login(bottoken);
|
||||
|
||||
|
||||
c.on('messageRecieved', /**@param {message} message*/ async (message) => {
|
||||
require('./messageTests.js')(message);
|
||||
(await import('./messageTests.js')).default(message);
|
||||
});
|
||||
|
||||
|
||||
c.on('interactionRecieved', /** @param {Interaction} interaction*/ async (interaction) => {
|
||||
require('./interactionTests.js')(interaction);
|
||||
(await import('./interactionTests.js')).default(interaction);
|
||||
});
|
||||
|
||||
|
||||
c.on('guildCreate', async (guild) => {
|
||||
require('./guildTests.js')(c);
|
||||
(await import('./guildTests.js')).default(c);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user