mirror of
https://github.com/LBRYFoundation/lbry-wunderbot.git
synced 2025-08-23 17:47:27 +00:00
Merge branch 'master' into patch-15
This commit is contained in:
commit
33dfba4bd0
4 changed files with 141 additions and 2 deletions
100
bot/modules/rolesetter.js
Normal file
100
bot/modules/rolesetter.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
|
||||
var config = require('config');
|
||||
rolelist = config.get('rolelist');
|
||||
|
||||
exports.commands = [
|
||||
"addrole", // command that is in this file, every command needs it own export as shown below
|
||||
"delrole",
|
||||
"roles"
|
||||
]
|
||||
|
||||
exports.addrole = {
|
||||
usage: "<role to add>",
|
||||
description: 'description of command',
|
||||
process: function(bot,msg,suffix){
|
||||
// Here the bot,msg and suffix is avaible, this function can be async if needed.
|
||||
//amsg.reply(rolelist.allowedroles.includes(suffix));
|
||||
var newrole = msg.guild.roles.find('name', suffix);
|
||||
//var rolecheck = msg.guild.roles;
|
||||
//var rolecheckvar = JSON.parse(rolecheck).find('name', suffix);
|
||||
|
||||
//console.log('Addrole Event firing.');
|
||||
//console.log(rolelist);
|
||||
//console.log(rolelist.allowedroles);
|
||||
//console.log(config.get('allowedroles'));
|
||||
if (rolelist.allowedroles.includes(suffix)) {
|
||||
//console.log('Role is in allowed roles.');
|
||||
//console.log('Role to add: ' + newrole);
|
||||
if (!msg.member.roles.find('name', suffix)) {
|
||||
msg.member.addRole(newrole)
|
||||
.then(msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!'));
|
||||
//console.log('Added role')
|
||||
//msg.channel.send(msg.member + ' has been added to the ' + suffix + ' role!');
|
||||
}
|
||||
else{
|
||||
msg.channel.send('It seems that you already have that role! Try removing it first with the delrole command!');
|
||||
}
|
||||
}
|
||||
else {
|
||||
msg.channel.send("That role isn't one you can add yourself too! Please run the roles command to find out which ones are allowed.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
exports.delrole = {
|
||||
usage: "<role to remove>",
|
||||
description: 'description of command',
|
||||
process: function(bot,msg,suffix) {
|
||||
// Here the bot,msg and suffix is avaible, this function can be async if needed.
|
||||
let oldrole = msg.guild.roles.find('name', suffix);
|
||||
//console.log(oldrole);
|
||||
//console.log('Delrole Event firing.');
|
||||
//console.log(msg);
|
||||
//console.log('Printing Suffix! ' + suffix);
|
||||
if (rolelist.allowedroles.includes(suffix)) {
|
||||
if (msg.member.roles.find('name', suffix)) {
|
||||
msg.member.removeRole(oldrole)
|
||||
.then(msg.channel.send(msg.member + ' has been removed from the ' + suffix + ' role!'));
|
||||
}
|
||||
else {
|
||||
msg.channel.send("You don't seem to have that role! Try adding it first with the addrole command!");
|
||||
}
|
||||
}
|
||||
else {
|
||||
msg.channel.send("That role isn't one you can add yourself too! Please run the roles command to find out which ones are allowed.");
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
exports.roles = {
|
||||
usage: "",
|
||||
description: 'description of command',
|
||||
process: function(bot,msg,suffix){
|
||||
// Here the bot,msg and suffix is avaible, this function can be async if needed.
|
||||
msg.channel.send({embed: {
|
||||
color: 3447003,
|
||||
title: "Wunderbot",
|
||||
description: "You have accessed the rolebot function of Wunderbot!",
|
||||
fields: [{
|
||||
name: "List of roles",
|
||||
value: buildRoleString(rolelist.allowedroles),
|
||||
inline: false
|
||||
}],
|
||||
footer:{
|
||||
icon_url: msg.author.avatarURL,
|
||||
text: 'Requested by: ' + JSON.stringify(msg.author.username)
|
||||
}
|
||||
|
||||
}});
|
||||
//msg.channel.send(JSON.stringify(rolelist.allowedroles));
|
||||
}
|
||||
};
|
||||
|
||||
function buildRoleString(roles) {
|
||||
let str = "";
|
||||
for (let i = 0; i < roles.length; i++) {
|
||||
str += "`" + roles[i] + "`" + '\n';
|
||||
}
|
||||
return str;
|
||||
}
|
|
@ -10,8 +10,8 @@ exports.commands = [
|
|||
]
|
||||
exports.tip = {
|
||||
usage: "<subcommand>",
|
||||
description: 'balance: get your balance\n deposit: get adress for your deposits\n withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS\n <user> <amount>: mention a user with @ and then the amount to tip them',
|
||||
description: 'balance: get your balance\n deposit: get address for your deposits\n withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS\n <user> <amount>: mention a user with @ and then the amount to tip them',
|
||||
process: async function(bot,msg,suffix){
|
||||
return; // Tipping is now handled by the separate tipbot(in branch tipbot_dc), no need to to anything here...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
36
bot/modules/welcome.js
Normal file
36
bot/modules/welcome.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
exports.custom = [
|
||||
"onUserJoin"
|
||||
]
|
||||
exports.onUserJoin = function(bot) {
|
||||
|
||||
bot.on('guildMemberAdd', member => {
|
||||
member.send(
|
||||
"**Welcome to Lbry Discord!** \n" +
|
||||
"Please respect everyone in the community \n" +
|
||||
"1. No begging for Free Coins \n" +
|
||||
"2. **No Harrasing** other community members this includes any **racist comments** in the server! \n" +
|
||||
"3. Dont be Afraid to ask questions, please use proper channels when doing so \n" +
|
||||
" we have dedicated channels like ***#feedback-and-ideas #mining #market-and-trading #random** for your needs \n" +
|
||||
"4. If you need help please use the channel #help and someone will assist you \n" +
|
||||
"5. **#general** is to be used for general talk about lbry off-topic stuff find the right channel please \n" +
|
||||
"**If your here for *Verification* please go to **#verification** channel and post you'd like to be verified and mod will get to you asap, please be patient as we are not up 24/7 to monitor all activity in that channel** \n" +
|
||||
"\n\n" +
|
||||
"*NOTE: the platform is in Beta, you may encounter bugs or errors, we are aware of most issues please check our github(https://github.com/lbryio/lbry-app/issues) for issues that you may come across before reoprting it, thanks for your time and patience*"
|
||||
);
|
||||
member.send(
|
||||
{
|
||||
"embed": {
|
||||
"title": "*Click Here for more Info!*",
|
||||
"description": "[**LBRY**](https://lbry.io) is a protocol providing fully decentralized network for the discovery, distribution, and payment of data. It utilizes the [**LBRY blockchain**](https://lbry.io/what#the-network) as a global namespace and database of digital content. Blockchain entries contain searchable content metadata, identities, and rights and access rules. \n[_**Get the App here**_](https://lbry.io/get)",
|
||||
"url": "https://lbry.io/what",
|
||||
"color": 7976557,
|
||||
"author": {
|
||||
"name": "What is LBRY?",
|
||||
"url": "https://lbry.io/what",
|
||||
"icon_url": "https://i.imgur.com/yWf5USu.png"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
|
@ -19,5 +19,8 @@
|
|||
},
|
||||
"speechbot":{
|
||||
"channelIDs": ["363085078403874823","363086945976320010","363088045366312962","363084262028607488","369896313082478594","363084227518136322"]
|
||||
},
|
||||
"rolelist":{
|
||||
"allowedroles": ["Role1","Role2"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue