Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = (client, messageReaction, user) => {
- const mysql = require('mysql');
- require('dotenv').config();
- const connection = mysql.createConnection({
- host: 'localhost',
- user: 'bot_user',
- password: process.env.DB_PASS,
- database: 'discord'
- });
- connection.connect();
- connection.query(
- 'SELECT role_id FROM role_reaction WHERE message_id = "' + messageReaction.message.id + '";',
- function(error, results, fields){
- if(error) return console.log(error);
- if(results[0] === undefined){
- connection.end();
- return;
- } else{
- for(let i = 0; i < results.length; i++){
- user.roles.add(Object.values(results[0])[i]);
- }
- connection.end();
- }
- }
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement