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 `; this.permissions = { roles: ['662163685439045632', '701454780828221450'] }; this.aliases = ['code']; this.enabled = true; } public async run(message: Message, args: string[]) { try { if (!args.length) return this.client.commands.get('help').run(message, [this.name]); const code = randomBytes(5).toString('hex'); if (!this.client.util.isValidEmail(args[0])) return this.error(message.channel, 'The email address provided is invalid.'); this.client.util.transport.sendMail({ to: args[0], from: 'Library of Code sp-us | Cloud Services ', subject: 'Email Verification Code', html: `

Library of Code | Cloud Services

Please provide the code provided below to the Staff member working with you on account creation.

${code}

Want to support us?

You can support us on Patreon! Head to our Patreon page and feel free to donate as much or as little as you want!
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!

Library of Code sp-us | Support Team `, }); return this.success(message.channel, `Code: \`${code}\` | Email Address: ${args[0]}`); } catch (error) { return this.client.util.handleError(error, message, this); } } }