update login
This commit is contained in:
1 parent
dd1db5c9c9
commit
2ff1aa5153
1 file changed
+7
-33
@@ -31,39 +31,7 @@ class Bot {
|
|||||||
|
|
||||||
// Remote Login
|
// Remote Login
|
||||||
async remoteLogin(message, args) {
|
async remoteLogin(message, args) {
|
||||||
let user = await this.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
return message.channel.send('Login from Lines Police CAD account management https://www.linespolice-cad.com/');
|
||||||
if (user) return message.author.send(`You are already logged in ${message.author}! Use \`?logout\` to logout or \`?account\` to see your logged in account.`);
|
|
||||||
if (args.length==0) return message.author.send(`You must provide a \`email\` and \`login token\` ${message.author}!`);
|
|
||||||
if (!args[0]==null||!args[0]==undefined&&args[1]==null||args[1]==undefined) return message.author.send(`You must provide a \`login token\` ${message.author}!`);
|
|
||||||
user = await this.dbo.collection("users").findOne({"user.email":args[0]}).then(user => user);
|
|
||||||
if (user==null||user==undefined) return message.author.send(`Cannot find the email \`${args[0]}\` ${message.author}!`);
|
|
||||||
|
|
||||||
// Check discord Token
|
|
||||||
if (args[1]==user.user.discordLoginToken) {
|
|
||||||
// Modify user to include user.user.discord
|
|
||||||
let discord = {
|
|
||||||
id: message.author.id,
|
|
||||||
username: message.author.username,
|
|
||||||
discriminator: message.author.discriminator
|
|
||||||
}
|
|
||||||
let newToken = randomstring.generate(12);
|
|
||||||
this.dbo.collection("users").updateOne(
|
|
||||||
{
|
|
||||||
"user.email": args[0]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$set: {
|
|
||||||
"user.discord": discord,
|
|
||||||
"user.discordLoginToken": newToken
|
|
||||||
}
|
|
||||||
}, function(err,res) {
|
|
||||||
if (err) throw err;
|
|
||||||
return message.author.send(`Logged in as \`${user.user.username}\` ${message.author}!`);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return message.author.send(`Incorrect login token ${message.author}! Try again or Regenerate your Discord Login Token.`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async remoteLogout(message) {
|
async remoteLogout(message) {
|
||||||
@@ -673,6 +641,12 @@ class Bot {
|
|||||||
return message.channel.send(`Current Ping on Panic Status: ${guild.server.pingOnPanic} ${message.author}`);
|
return message.channel.send(`Current Ping on Panic Status: ${guild.server.pingOnPanic} ${message.author}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async createBolo(message, args) {
|
||||||
|
if (args.length==0) return message.cahnnel.send(`You must provide a \`\` `);
|
||||||
|
let user = await this.dbo.collection("users").findOne({"user.discord.id":message.author.id}).then(user => user);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
client.on('ready', () => {
|
client.on('ready', () => {
|
||||||
console.log(`Logged in as ${client.user.tag}`);
|
console.log(`Logged in as ${client.user.tag}`);
|
||||||
|
|||||||
Reference in new issue
Block a user