I was looking at some guides but alot of them are either quite confusing as i am new to coding (especially related to discord bots) or follow a guide to something im not planning on making. I wanted to ask, where should i start if i want to make a bot that does the following:
Takes user input either in a form of a command or reaction (they make a shopping list with items and # of items)
Stores the information in a nested list (shows everyones shopping list + item counts)
this list can be viewed based on another user input (i.e someone goes !personAshopping)
I am familiar with python language but i know that discord bots are usually not in python
Related
I have a list of video games in my database. The user is suposed to choose their favorite games by selecting the checkbox of the wanted game.
So I have a form with the entiere list of these games. For now I use a For condition to display all the entries from my database/table.
But now I have a huge list of game that the user can choose, so I can't display everything.
Do you think It could be a good solution if I replace my system by placing a search bar which could dynamicly search and add a game.
Is there a right way to do this with Django ?
If not, could you give me the simpliest solution to solve my problem ?
Thank you.
Probably you should make use of both approaches: have a list of (ordered by) most played games which could contain a few tens of games (with the possibility to "view more" at the end of the list) for users who don't know yet what game to play and who like to discover new games. And also have a search box where users can enter the name of a game if they already know what they want to play and don't want to look it up in a list of games.
For the "view more" part of the list you should use ajax to make calls to django app without reloading the entire page and retrieve a number of games by each call. This will be more like a Single Page Application (like Twitter, for example).
Or you could use pagination and retrieve and display all games from the start and use a cache framework (and cache the query that retrieve all games) if there are performance issues.
I am currently building a simple site where users can login and write comments. Its somewhat similar to a forum but difference is that users will see image/an article and they get to comments on things based what they see. In addition they also get to rate what they see in 5 star scale or thumbs up thumbs down.
I have build this site using django now I want to add another application where I can control who gets to see the 5 star scale vs. thumbs up and thumbs down scale after they log in to the site. I want to randomly pic users as they come into the site and make sure half of the user population see one scale vs the other.
Here are my questions:
How should the random selection take place? Does django has inbuilt function or functionality to do such randomization?
Can someone provide simple example?
Here is my thought process on building such thing:
We create a model where we keep track of the userid, experimentGroup(5 Star or Thumbs up), Time
Then in each template we check if which group the user is in and based on that we adjust the users view?
I am new django so it would be great is someone provides a simple example so I can built upon that. After doing google search I found out a very heavy django application but I would rather user something simple that I can understand and control with my limited knowledge.
You can get objects in a random order by using (from django docs):
<YOUR_MODEL>.objects.order_by('?')
The exact queryset depends of how you define your models
Also django provide a template filter to random a list of items (see django docs)
Last, if above is not enough you can use python random module
Maybe this isn't the correct place to ask, but I asked this question on Joomla forums and did not get any answers. If someone can help me or at least point me in the right direction, I would really appreciate.
My question is: In a Joomla 2.5 website, I want to create two different kinds of forms for registering users. Maybe "registering" isn't the correct term. I want to create something like a very simple database which will hold records for two kinds of users:
- one which will be interested in working in projects, so in this case the form will have more fields and specific details to fill
- one which will be interested only in receiving newsletters from the site, and in this case only basic contact information will be required.
I did some research and found an extension named AcyMailing which can handle the newsletters for example, but I need to have all my potential users registered as Joomla users. I would like to avoid that if possible. If not, how can I differentiate the two kinds of users on registration, so the visitor can choose which option he wants and in this case, add more information to the registering process, if possible.
I'm not very experienced with Joomla, but since the site in question is already implemented using it, I don't have much choice.
Thanks in advance!
Chronoforms. Most definitely here would be a great use for their AWESOME free component. Your forms can work as registration forms (should you desire that); or can also just be free standing forms that log the information filled out on them to your database which you can later use however you would like (i.e. compiling a mailing list or something of that sort).
The form wizard makes it almost bullet proof, then you can have a form for 1 type of user to fill out, and a form for a different user build different ways.
That will get you the data - in order to mass mail those people you'll need a way to extract their emails out of the database (or find an email component that will let you email based on certain fields in the database or what have you); but it's totally possible and would be easily done I think with 1 simple mySQL query on your database table created by chronoforms.
In terms of something that will solve your issue quickly and get you the info you're looking for in two separate ways - chronoforms will do that exactly.
I'm writing an classified ads website, I need that the users renew the Ads only clicking in a URL that I will send by email. What cautions should I have implementing a system like this? I've searched on the web but didn't find examples of an implementation like this.
Can someone give some clues about the right path to do this?
Best Regards,
First off, SQL Injection will be a major thing to worry about, especially when using obvious get parameters.
Second, you will want non-personally identifying info in the GET parameters. You will NOT want short ids such as 123456 as these are VERY EASILY guessed. A GUID (example 412dc535-03dd-4887-b702-02c8b85e8891, you would remove the - of course) is great for this.
Third, you will want some sort of basic verification that it is in fact the user that originated the request. Have each email have its own ID for the one click action, perhaps a GUID (long string of random characters), and make them expire after some time (a few days). Keep track of each email link separately and what they're supposed to do, so that someone couldn't just figure out the ID of someone's ad and keep running it over and over.
~Christian
I am blocking a huge number of bots, except the ones from search engines, and then only allowing 2seconds of session management.
However, spam bots are still able to by-pass these measure and create a huge number of requests which is 'killing' the server.
I have read other articles on this site but none seem to directly answer this issue.
A bot probably behaves faster than a human. You could time how long it takes them to fill out the form. Anything less than a second or two is a bot.
A bot probably doesn't have JavaScript turned on. You could use that to your advantage.
You could hide a link via css (or not give it any text) that takes the bot to a bot.cfm page, which could then set a session value.
There are some open source projects but I can't remember the names of them off the top of my head.
CF10 has a new validation function.
Ben Nadel has written some useful posts in his blog regarding spiders/bots.
http://www.bennadel.com/blog/1083-ColdFusion-Session-Management-And-Spiders-Bots.htm
http://www.bennadel.com/blog/154-ColdFusion-Session-Management-Revisited-User-vs-Spider-III.htm
For forms, I use <cfimage> to create a captcha image. I have found that stuffing the captcha phrase in a session variable can cause problems (I can't remember what the problems were though). So, I now use <cfencrypt> to include an encrypted phrase in the form itself. The action page decrypts the phrase and compares it to what the user put in the captcha form field.
I've found CFSPAMProtect to be very useful at blocking automated form fillers.
It bases its SPAM/HAM test on an aggregate score of a number metrics including time on page, mouse movement (via JS) as well as the classic hidden form fields that shouldn't be filled in (but are filled in by dumb robots).
You can assign your own weightings and monitor the SPAM catch via email to allow you to tailor things.
It can work on its own or link to some third party SPAM tools such as Akismet.
So far I've found that it's good enough on it's own.
It's a custom tag and easy to implement in existing forms too which is nice.
Give it a go...