update/leave community
This commit is contained in:
1 parent
5242344db3
commit
a8f4785478
1 file changed
+66
@@ -0,0 +1,66 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
const io = require('socket.io-client');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "leavecommunity",
|
||||||
|
description: "Leave your active community",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
|
member: [],
|
||||||
|
},
|
||||||
|
aliases: ["leave"],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, message) => {
|
||||||
|
let user = await client.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||||
|
if (!user) return message.channel.send(`You are not logged in.`);
|
||||||
|
let myReq = {
|
||||||
|
userID: user._id
|
||||||
|
};
|
||||||
|
const socket = io.connect(client.config.socket);
|
||||||
|
socket.emit('bot_leave_community', myReq);
|
||||||
|
socket.on('bot_left_community', (data) => {
|
||||||
|
socket.disconnect()
|
||||||
|
if (data.error) {
|
||||||
|
return message.channel.send(`${data.error}`);
|
||||||
|
}
|
||||||
|
return message.channel.send(`${data.message}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
SlashCommand: {
|
||||||
|
options: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let user = await client.dbo.collection("users").findOne({"user.discord.id":interaction.member.user.id}).then(user => user);
|
||||||
|
if (!user) return interaction.send(`You are not logged in.`);
|
||||||
|
let myReq = {
|
||||||
|
userID: user._id
|
||||||
|
};
|
||||||
|
const socket = io.connect(client.config.socket);
|
||||||
|
socket.emit('bot_leave_community', myReq);
|
||||||
|
socket.on('bot_left_community', (data) => {
|
||||||
|
socket.disconnect()
|
||||||
|
if (data.error) {
|
||||||
|
return interaction.send(`${data.error}`);
|
||||||
|
}
|
||||||
|
return interaction.send(`${data.message}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in new issue
Block a user