mirror of
https://github.com/PretendoNetwork/Yamamura.git
synced 2024-05-15 19:35:00 -04:00
Moved events to files
This commit is contained in:
parent
5563cb5e10
commit
5e25588511
|
@ -12,6 +12,7 @@
|
|||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"jsdoc/no-undefined-types": 1,
|
||||
"require-atomic-updates": "warn",
|
||||
"no-case-declarations": "off",
|
||||
"no-empty": "off",
|
||||
|
@ -39,5 +40,8 @@
|
|||
"error",
|
||||
"always"
|
||||
]
|
||||
}
|
||||
},
|
||||
"plugins": [
|
||||
"jsdoc"
|
||||
]
|
||||
}
|
73
src/bot.js
73
src/bot.js
|
@ -1,5 +1,7 @@
|
|||
const { SlashCreator, GatewayServer } = require('slash-create');
|
||||
const Discord = require('discord.js');
|
||||
const guildMemberAddHandler = require('./events/guildMemberAddHandler');
|
||||
const messageHandler = require('./events/message');
|
||||
const config = require('../config.json');
|
||||
|
||||
const intents = ['GUILDS', 'GUILD_MEMBERS'];
|
||||
|
@ -28,75 +30,8 @@ creator
|
|||
])
|
||||
.syncCommands();
|
||||
|
||||
bot.on('message', message => {
|
||||
// Ignore bot messages
|
||||
if (message.author.bot) return;
|
||||
|
||||
// Check if the message is a command and handle it
|
||||
if (message.content === '.toggleupdates') {
|
||||
message.reply('Looks like you tried to use a legacy command! Try our new slash commands by just typing "/"!');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
bot.on('guildMemberAdd', member => {
|
||||
const embed = new Discord.MessageEmbed();
|
||||
|
||||
embed.setColor(0x1B1F3B);
|
||||
embed.setTitle('Pretendo Network');
|
||||
embed.setURL('https://pretendo.network');
|
||||
embed.setDescription('\u200b');
|
||||
embed.setThumbnail('https://i.imgur.com/8clyKqx.png');
|
||||
embed.setImage('https://i.imgur.com/CF7qgW1.png');
|
||||
embed.addFields([
|
||||
{
|
||||
name: '📃 Social Media',
|
||||
value: '\u200b'
|
||||
},
|
||||
{
|
||||
name: '<:patreonlogo:886254233786138635> Patreon',
|
||||
value: 'https://patreon.com/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '<:twitterlogo:886254233962291241> Twitter',
|
||||
value: 'https://twitter.com/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '<:twitchlogo:886254234201362473> Twitch',
|
||||
value: 'https://twitch.tv/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '<:youtubelogo:886254234226528337> YouTube',
|
||||
value: 'https://youtube.com/c/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '\u200b',
|
||||
value: '\u200b'
|
||||
},
|
||||
{
|
||||
name: '<:rulestext:886254514141806643> Rules',
|
||||
value: '\u200b'
|
||||
},
|
||||
{
|
||||
name: ':one:',
|
||||
value: 'No advertising unless explicitly allowed to do so by one of the developers'
|
||||
},
|
||||
{
|
||||
name: ':two:',
|
||||
value: 'Do not share anything illegal. This includes illegal game/fw dumps, any console SDK, etc. We are unsure as to what is illegal to share, so keep all that to the DMs just to be safe'
|
||||
},
|
||||
{
|
||||
name: ':three:',
|
||||
value: 'Respect channel names and topics. Offtopic chat goes in the offtopic channel'
|
||||
},
|
||||
{
|
||||
name: ':four:',
|
||||
value: 'Be kind. If someone asks a question you can help with, be nice about helping them. Know your audience'
|
||||
}
|
||||
]);
|
||||
|
||||
member.send('Thank you for joining the Pretendo Network Discord server! Check below for some server information and links', { embed });
|
||||
});
|
||||
bot.on('guildMemberAdd', guildMemberAddHandler);
|
||||
bot.on('message', messageHandler);
|
||||
|
||||
bot.login(config.token).then(() => {
|
||||
console.log('ready');
|
||||
|
|
66
src/events/guildMemberAdd.js
Normal file
66
src/events/guildMemberAdd.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
const Discord = require('discord.js');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Discord.GuildMember} member
|
||||
*/
|
||||
function guildMemberAddHandler(member) {
|
||||
const embed = new Discord.MessageEmbed();
|
||||
|
||||
embed.setColor(0x1B1F3B);
|
||||
embed.setTitle('Pretendo Network');
|
||||
embed.setURL('https://pretendo.network');
|
||||
embed.setDescription('\u200b');
|
||||
embed.setThumbnail('https://i.imgur.com/8clyKqx.png');
|
||||
embed.setImage('https://i.imgur.com/CF7qgW1.png');
|
||||
embed.addFields([
|
||||
{
|
||||
name: '📃 Social Media',
|
||||
value: '\u200b'
|
||||
},
|
||||
{
|
||||
name: '<:patreonlogo:886254233786138635> Patreon',
|
||||
value: 'https://patreon.com/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '<:twitterlogo:886254233962291241> Twitter',
|
||||
value: 'https://twitter.com/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '<:twitchlogo:886254234201362473> Twitch',
|
||||
value: 'https://twitch.tv/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '<:youtubelogo:886254234226528337> YouTube',
|
||||
value: 'https://youtube.com/c/PretendoNetwork'
|
||||
},
|
||||
{
|
||||
name: '\u200b',
|
||||
value: '\u200b'
|
||||
},
|
||||
{
|
||||
name: '<:rulestext:886254514141806643> Rules',
|
||||
value: '\u200b'
|
||||
},
|
||||
{
|
||||
name: ':one:',
|
||||
value: 'No advertising unless explicitly allowed to do so by one of the developers'
|
||||
},
|
||||
{
|
||||
name: ':two:',
|
||||
value: 'Do not share anything illegal. This includes illegal game/fw dumps, any console SDK, etc. We are unsure as to what is illegal to share, so keep all that to the DMs just to be safe'
|
||||
},
|
||||
{
|
||||
name: ':three:',
|
||||
value: 'Respect channel names and topics. Offtopic chat goes in the offtopic channel'
|
||||
},
|
||||
{
|
||||
name: ':four:',
|
||||
value: 'Be kind. If someone asks a question you can help with, be nice about helping them. Know your audience'
|
||||
}
|
||||
]);
|
||||
|
||||
member.send('Thank you for joining the Pretendo Network Discord server! Check below for some server information and links', { embed });
|
||||
}
|
||||
|
||||
module.exports = guildMemberAddHandler;
|
17
src/events/message.js
Normal file
17
src/events/message.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const Discord = require('discord.js');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Discord.Message} message
|
||||
*/
|
||||
function messageHandler(message) {
|
||||
if (message.author.bot) return;
|
||||
|
||||
// Check if the message is a command and handle it
|
||||
if (message.content === '.toggleupdates') {
|
||||
message.reply('Looks like you tried to use a legacy command! Try our new slash commands by just typing "/"!');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = messageHandler;
|
Loading…
Reference in a new issue