How can I assign permissions with modules to a bot? - c

I want to setup a discord bot for a friend who mixes music. Using a existing bot I have been able to make it work. However only I can issue commands. Every time I try to define permission as suggested by the creator it returns with a error saying "Don't know user (the actual module permission route command)"
I have tried summarizing the permissions in a lot of ways. Also looked up a lot about .json modules and the syntax. In case the description that came with it was wrong but I was unable to find anything useful. Not experienced with writing a bot but I also looked into maybe making a .js config and put commands etc in that since .js might be easier for me to use. But It seems like a huge workaround for a syntax error. I am not sure what the parent module for commands is so I tried a number of lines based of reflector when reading the .dll.
The commands I gave to the bot following the suggested syntax (aParentModule.aChildModule.aCommand(arg1,arg2,arg3))
"#BOT permissions assign Admin Voice"
Reply:That doesn't look quite right, I will ignore these entries: Voice
I don't know this person.
I tells me the person issue a lot so I think I am not dividing the request properly there. Can't find out how to though.
#BOT permissions assign Yourcall ,voice,join
Reply: That doesn't look quite right, I will ignore these entries: ,voice,join
I don't know this person.
The bot I am using can be found on github for reference: https://github.com/BinkanSalaryman/Discord-Audio-Stream-Bot
Commands from config.json with the permission command
"text": {
"commands": {
"botAgent": "tomoko",
"permissions": {
"defaultPermissions": "!bot.stop() !guild.leave() help.commands(path) !permissions.assign(USER_OR_ROLE,PERMISSIONS) utils.ping(host)",
"userPermissions": {},
"rolePermissions": {}
}
The error I get from the bot "Tomoko.json"
"warning_badUser": "I don't know this person.",
I want to be able to give join and leave command to a specific role and not just the bot creator To do that the bot needs to stop seeing the commands as user names from what I can see based of the response messages.

Related

Can anyone give a script specific to deleting messages in a specific channel from a specific role

I am not personally very adept with knowing how to make script commands I wondering if anyone knew exactly how to make a command where I can get a bot to delete messages from a specific role if they happen to try to message in a sirten channel.
I tried to look around the options for the bot commands but I was lost in trying to figure it out

What defines a message as 'cached' in discord.js

As we all know, in the change from v11 to v12, cache was introduced, however I can't find anything online that explains exactly what it is as a concept. Can anyone explain how it works?
I have just taken a look at the D.JS source and thankfully it is heavily commented.
In many files it suggests that any message that is sent by a user, or any message mentioning a user caches said user. This works in the same way with guilds I believe.
This means that in order to find a user in a server using #get or other fetch methods, the user must have been mentioned, or typed a message.
BaseManager.js source file here
Client.js source file here
GuildManager.js sournce file here

Organise files for multiple mini-games for Discord bot

EDIT : (rewrite)
So, I'm doing a mini-games bot for my discord server. I have already done a bot with multiples features and it was organize like that :
- My main was handling my events. I was checking where my event was called and according to the channel, I will run my corresponding file.js.
- I have my main folder, with inside, one folder with my commands, one with my "handler" (like members counting, and other autonomous things), and the last one with my images.
Do you think it's correct, bad, and what can I improve ?
Can you send me your idea or your point on vue on that.
I try to make my code better each time I code, and organization is one of the thing I want to improve.
I hope it's a much more understandable.
Please read the handy DiscordJS Guide that covers this subject and maybe put a little more effort into your research next time: https://discordjs.guide/command-handling/#individual-command-files

Can I change chat id?

I'm using the appengine. I'm going to use an app named Square for this example.
We have the domain www.square.com.
We cannot get square.appspot.com
We do have squares.appspot.com.
For moving the app over the www.square.com. We did this. Great! Very exciting.
But we also built a chat bot. We now need people to friend 'squares'. What we want is for people to friend 'square'.
So two questions please: Is there a way to get Square.appengine.com. From my research... I assume someone took it and it's now gone (remember 'square' just an example here).
Knowing #1... is there a way to change the chat bot 'name'? From Squares.appspot.com --> Square.appspot.com?
Thanks so much in advance!
It's a chat bot, for us to send a message to an individual they have to have it as a friend. In their friends list they see: squares.appspot.com. This isn't our domain or our name. We need it to say square.appspot.com. Preferably we could change the name...
which leads to the second question... how do we change the name that people see.
"If you've built the chat bot, why can't you jsut change it's name yourself?"
Am I missing something this simple? How?

Receiving / retrieving email in CakePHP

I am developing a basic yet highly customized CRM for a small training centre which has the ability to store student records and also send emails to them. I'm using SwiftMailer following this excellent tutorial in CakePHP to accomplish the sending part.
Of course, students are sometimes going to reply to emails and I'd like to retrieve them within my CRM and store them along with the student record.
However, I cannot find a single reference to doing this. I've tried the following Google searches: "receiving email cakephp" , "retrieving email cakephp" and even "email client cakephp" but all of these queries give results relating to sending mail rather than receiving it -- very frustrating!
Finally, I broadened my search to non-cake solutions and found someone recommending a library called ezComponents. It doesn't seem to have had any active development for about a year, but it includes an email receiving class which is exactly what I want. Unfortunately, I have no idea how to add this to CakePHP and the only post I've been able to find on the entire web on the matter doesn't exactly go into much detail. It's certainly not a step-by-step tutorial on using ezComponents on CakePHP like the SwiftMailer tutorial I mentioned above.
I also found a class on Google Code called php-imap which looks like it would do the job but, again, I haven't the slightest clue how to get it working happily in Cake like SwiftMailer is.
I realize that I may have to learn how to package classes for use in Cake by myself but I'm asking this question first on the off-chance that there is already a Cake-friendly solution to this problem that I just haven't realized :-)
Joseph
Thanks to everyone for your answers, but I've been doing some more searching and it looks like the solution is actually incredibly simple.
Basically, with the help of a plugin, I can set up the mail server in databases.php as a datasource and then write a Model and Controller to interact with it.
Here's the example I found: https://github.com/kvz/cakephp-emails-plugin
Edit: the repo has been deprecated and is now available at https://github.com/kvz/deprecated/tree/cakephp-emails-plugin
You will want to pipe your email to PHP and use stdin:// to read the contents of the email and add the e-mail to your database.
I've done this with cake and the simplest way is to make a Cake console application to handle the parsing. Also using cpanel's account level filtering to generate the pipe is really simple.
http://forums.cpanel.net/f5/piping-mail-php-scripts-howto-checklist-50985.html
http://www.evolt.org/incoming_mail_and_php
Sounds like you want to include SwiftMailer as a Cake plugin, amirite?
http://book.cakephp.org/view/1111/Plugins
-- if you want to package it yourself. Otherwise, a cursory search of the Bakery yielded this result:
http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins
Hopefully it will at least get you pointed in the right direction. HTH. :)

Resources