Organise files for multiple mini-games for Discord bot - discord.js

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

Related

WitAI - Your app may fail to handle this story properly

I've been playing with WitAI recently to see what it can do, and I had built a user flow of about 5/6 questions, with a couple of Yes/No/I don't know branches etc. I've set up a couple of "bot executes" options with the hope in the future that I will write some function on my side to do data processing etc.
But on every save now, I see a red light on the left side saying "Your app may fail to handle this story properly".
I've rebuilt a use flow with no bot executes, and no branches, and I've trained up the bot on each sentence to expect, but I still see this. I'm really confused, as there are no fields highlighted red to suggest that the bot doesn't understand that line. Can anyone help out here?

Batch ping listener and crude data transfer

As a project of personal interest I've been wondering if there would be some way to make a batch chat service. (I'm well aware of all kinds of alternatives, this more just a personal proof of concept, as I love finding unique ways of doing things.)
Now, the inbuilt messenger services for Windows, msg.exe and net send are no long available. Correct me if I'm wrong, but as far as I can tell, there are no longer any ways to send data from one IP to another through batch programming.
Or is there? I'm no expert, by any means. But it is still possible to ping other IPs through cmd. If it is possible for the pinged computer to reply (to state that it has pinged), then there must be an active listener. And if this listener is there, is it not then possible to code a batch program to transfer binary data through pings alone? E.g., it receives 1 bit per second (Or variable resolution based on your connection) based on if it were pinged within that unit of time or not?
I would love to be able to make a proof of concept of this extremely crude "Ping chat", but I'm not sure how I would access that "listener" to tell if I've been pinged.
Goal of this project is to make it in BAT format without downloading any third party scripts, so it would have to be using batch and default commands.
PS: Again, I know this is ridiculously crude and impractical, no need to remind me. It's just as an amusing proof of concept to theoretically circumvent the removal of the inbuilt functionality. Creating functionality that isn't otherwise there interests me greatly, such as when I made an online game client in Game Maker 8.1. There are better ways to do it, for sure. It just for personal amusement.
Much love, all!

What is the best solution to manage data from csv file and do some logic and action

Intro
I have learn basic programming in the past at school (vb) so i understand the logic behind an application and the way it think.
I started this week to learn python because ... I would like to be able to build what i need without having to smash my head in the keyboard.
In the mean time i would like to resolve my problem and i'm asking to all of you in case someone have seen something somewhere.
I have try to search but not sure how to ask so respond was not relevant.
My Question
I know i can do this in excel but i'm looking for another way if possible.
Does someone knows if there existe an application online or on a mac that give me the ability to:
1- Import data from a csv file and add it in a database. So every day i will log 100 line of data.
2- After that i would like to manage condition related on data store in store in file 2 and 3.
3- That will generated a file 4 where i can see the only important case i have to take care for the day.
I imagine a little bit Access from microsoft but i don't remember if i was able to add parameter on the data i will visualise or condition.
What i'm trying to achieve
I have to process a lot of data manually right now and i'm trying to find a way to take out automatically the recurring problem from a list that i receive every day And there is no other way for me than build my own validation process.
Thank for your help. I'm new but i will try my best to bring something is this community (Python studies lv1, VB -15ans) . For now i'm building my startup And my expertise is more in technical skill on security products and technical support.
In case i'm not alone that would like to be able to do some basic thing like i was needed without having to program from scratch a database program i found those 2 solution yet:
https://www.zoho.com/creator/
and
http://www.ifreetools.com/

Generating multiple files based on DB query in a nice way

I have a following question.
I have to generate many files based on sql query.
Let's say for example, I have get from database a list of orders made today and genarate file for each order and later store each file on ftp.
Ideally I would like to get follewing.
Not quite sure how to get it.
from(MyBean).to(Ftp)
The problem and main question is how to generate multiple messages by custom bean (for example).
I am not sure if splitter EIP is ok in this case
because in my case I have not just one message to split, but I just have to generate and send many messages.
http://camel.apache.org/splitter.html
I hope, someone meet this problem before.
If the task will be to generate just one file - everything is quite simple - you need just fill Exchange.OutMessage (or something like this). But what about multiple files - I really can't get, how to manage this situation.
P.S. Sorry if this question is stupid.
I am novice in Camel (working with it just for coupe weeks).
It's a great tool.
Actually, that's why I want to use in in the best way.
Thanks a lot.
from("bean:myBean").split(body()).to("bean:ftpBean")
just make sure myBean returns a List of messages and they will be split and sent individually to your FTP endpoint...

Heuristics to discover spammers/bots (In forums, blogs etc)

The ways I can think of are:
Measure the time between actions.
Compare the posts' content (if they're too similar to each other) or, better yet, only the posted links.
Checking the distribution over a period of time the user is active (if the user is active, say posting once every hour, for a week, then either we have a superman or a bot here).
Some special activity expected: like in stackoverflow, I would expect users to press their user name link (top middle) to see their new answers, comments, questions etc.
(added by chakrit) Number of links in a post.
Not heuristic. Use some async JS for user login. (Just makes life a bit harder on the bot programmer).
(added by Alekc) Not heuristic. User-agent values.
And, How could I forget Google's approach (mentioned down by Will Hartung). Give users the ability to mark someone as Spam, enough Spam votes means this is a Spam user. (calculating what is enough users, is the work here).
Any more ideas?
I might be over estimating the intelligence of bot creators, but number 6 is completely useless against any semi decent bot creator. Using the C# browser control to create your bot would pretty much render 6 useless. From what I've seen with that type of software that's a pretty common approach.
Validating on the useragent is pretty much useless too all of the blog spam I use to get was from bots appearing to be valid web browsers.
I use to get a lot of blog spam. I would literally be deleting hundreds of comments a day. I made use of reCaptcha and now I might get 1 a month.
If you really try to make something like this. I would attempt by doing the following:
User starts off with no ability to post a url.
After X number of posts have been analyzed in relation to the other posts in the thread then give them access to post urls.
The users activity on the site, the post quality, and what ever other factors you deem necessary will be a reputation for that users IP.
Then based the reputation of the IP and the other IPs on the same subnet you can make other decisions on whatever you want.
That was just the first thing that came to mind. Hope it helps.
The number of links in a post.
I believe I've read somewhere that Akismet use the number of links as one of its major heuristics.
And most of spam comments at my blog contains 10+ links in them.
Speaking of which... you just might want to check out the Akismet API itself .. they are extremely effective.
How about a search for spam related keywords in the post body?
Not a heuristic but an effective approach: You can also keep up-to-date with the stats published by StopForumSpam using their APIs.
Time between page visits is common I believe.
I need to add a comment section to my personal site and am thinking of asking people to give me their email address; I'll email them a "publish comment" link.
You might want to check if they've come from a Spam blacklist IP address (See http://www.spamhaus.org/)
There is another answer that suggests using Akismet for detecting spam, which I completely endorse.
However, they are not the only player on the block.
There is TypePad AntiSpam which uses the same heuristics as Akismet, as well as the same API (just a different URL and api key, the structure of the calls is the same). It can be safe to say they pretty much take the same approach as Akismet.
You might also want to check out Project Honeypot. From what I can tell, it can do a lookup based on the IP address of the user, and if it is a known malicious IP, it will tell you (harvester or something like that).
Finally, you can check LinkSleeve which approaches comment spam with what it claims to be a different way. Basically, it checks the links that are being linked to in comments, and based on where the links are going to, makes a determination.
Don't forget the ultimate heuristic: The "Report Spam" button that users can click. If nothing else, this gives you as administrator a chance to update your rule base for stuff that may be slipping through. Of course, you can simply delete the offending post and user right away as well.
I have some doubts about 4° point, anyway i would also add User-Agent. It's pretty easy to fake, but in my experience, about 90% of bots are using Perl as UA
I am sure there is a webservice of some kind that you can get a list of top SEO keywords, check the content for those keywords. if the content is to rich in keywords suspect it as being spam.

Resources