forked from engineering/cloudservices
command for email verification
parent
2159845d46
commit
09de117cbd
|
@ -0,0 +1,43 @@
|
||||||
|
/* eslint-disable consistent-return */
|
||||||
|
import { randomBytes } from 'crypto';
|
||||||
|
import { Message } from 'eris';
|
||||||
|
import { Client } from '..';
|
||||||
|
import { Command, RichEmbed } from '../class';
|
||||||
|
|
||||||
|
export default class EmailCode extends Command {
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.name = 'emailcode';
|
||||||
|
this.description = 'Sends a code to an email address to use for address verification.';
|
||||||
|
this.usage = `${this.client.config.prefix}emailcode <email address>`;
|
||||||
|
this.permissions = { roles: ['446104438969466890'] };
|
||||||
|
this.aliases = ['code'];
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(message: Message, args: string[]) {
|
||||||
|
try {
|
||||||
|
const code = randomBytes(5).toString('hex');
|
||||||
|
if (!this.client.util.isValidEmail(args[0])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid email address supplied.***`);
|
||||||
|
this.client.util.transport.sendMail({
|
||||||
|
to: args[0],
|
||||||
|
from: 'Library of Code sp-us | Cloud Services <help@libraryofcode.org>',
|
||||||
|
subject: 'Email Verification Code',
|
||||||
|
html: `
|
||||||
|
<body>
|
||||||
|
<style>* {font-family: 'Calibri';}</style>
|
||||||
|
<h1>Library of Code | Cloud Services</h1>
|
||||||
|
<p>Please provide the code provided below to the Staff member working with you on account creation.</p>
|
||||||
|
<h2>${code}</h2>
|
||||||
|
<h3>Want to support us?</h3>
|
||||||
|
<p>You can support us on Patreon! Head to <a target="_blank" href="https://www.patreon.com/libraryofcode">our Patreon page</a> and feel free to donate as much or as little as you want!<br>Donating $5 or more will grant you Tier 3, which means we will manage your account at your request, longer certificates, increased Tier limits as well as some roles in the server!</p>
|
||||||
|
<b><i>Library of Code sp-us | Support Team</i></b>
|
||||||
|
</body>
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
message.channel.createMessage(`***${this.client.stores.emojis.success} Code: \`${code}\` | Email Address: ${args[0]}***`);
|
||||||
|
} catch (error) {
|
||||||
|
await this.client.util.handleError(error, message, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue