Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
v2.1.0 focuses mainly on improvements to the auto-updater. Oh, and it's completely open-source (available under the MIT license) now!
Please post them here! It would be really helpful if you do.
Offline
Just have to point out the file storage because you pointed it out, why bother with binary when the only benefit is speed when the only things that are written are infrequent things and most of the data is stored in memory without the need to read or write. Also, as you mentioned XML I don't think you have used the holy grail of general data storage of the JSON file.
The reports and comments does sound interesting and will be used for bullying in a few circumstances.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
The reports and comments does sound interesting and will be used for bulling in a few circumstances.
I don't understand what "bulling" means. I assume it is a typo for "bullying".
Yes. The report system may be used for bullying. I understand. That's why I added the number of reports for a ban option, and I set it to 5 as default.
If bulling means "speaking bulls***", then the 1 comment per person limitation will take care of that. The owner of the bot can also remove comments if he wants, through the GUI. The same is true for reports. I can report you only once if I wanted to. The owner can also remove reports.
EDIT:
(below)
Oh lol well anyways I think I answered that.
Offline
Whoops, I did mean bullying and nothing else.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
Saving settings would be best to use JSON. I really like JSON now. And it's easy to read too.
I don't know why binary would be best. What if you want to edit an setting in the document when it's binary? I mean in notepad.
Instead of using this:
if (e.GetString(1u).StartsWith("!") || e.GetString(1u).StartsWith(".") || e.GetString(1u).StartsWith("@"))
{
You could use regex, which is better and easier.
if (Regex.IsMatch(line.Substring(0, 1), @".|,|-|_|!|\&|%|\?"))
{
Then can people use . , - _ & ! % ? as first letter.
You could also use something like this if you want to use !help x
Offline
Careful, "." in regex means any non-breaking character, and make it search only the beginning of the string.
You want this:
[\.,\-_!&%?]
____
How I would do it:
(match the whole incoming text for ease and you can use the match to filter off commands)
Regex.IsMatch(line, regex)
Valid command format:
^[\.,\-_!&%?][A-Za-z]+\b
For overkill, if you want to allow anyone to use whatever punctuation as a prefix:
^[^a-zA-Z0-9][A-Za-z]+\b
Extending this you could match other variables in a neat manner
^[^a-zA-Z0-9]([A-Za-z])+\b( [A-Za-z0-9]+)*
Match m = Regex.Match(line, @"^[^a-zA-Z0-9]([A-Za-z])+\b( [A-Za-z0-9]+)*)");
if(m.Success)
{
string command = m.Groups[0].Value; //This doesn't include whatever prefix was used.
string var1 = m.Groups[1].Value;
string var2 = m.Groups[2].Value;
//...
}
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
Careful, "." in regex means any non-breaking character
You want this:
^[\.|,|-|_|!|\&|%|\?]
I guess I forgot to add \ to .
Offline
Or you just make it
^[.,-_!&%?]
All chars between [] are automatically escaped.
Besides, I think you meant to use () instead of [].
Offline
Or you just make it
[^.,-_!&%?]
All chars between [] are automatically escaped.
Besides, I think you meant to use () instead of [].
*deep sigh* good point, makes no sense to have [|]; I blame C&Ping capasha
Still need to put the start outside and escape . and - though
^[\.,\-_!&%?]
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
Still need to put the start outside and escape . and - though
Yeah, edited it, for some reason I thought you meant to use negative (instead of start of string).
Offline
Koya wrote:Still need to put the start outside and escape . and - though
Yeah, edited it, for some reason I thought you meant to use negative (instead of start of string).
I'm matching the whole chat message while capasha is matching the first char.
Extended overkill ftw!
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
This whole regex thing seems confusing but amazing...
Could anybody give me 1448 a link to a guide using regex?
I think we all need to start using this instead of StartsWith
Offline
@OP - what other new features are you planning to add to this bot?
This whole regex thing seems confusing but amazing...
Could anybody give me 1448 a link to a guide using regex?
I think we all need to start using this instead of StartsWith
Regex is super useful and would be a core programming skill (it's cross-language too - even in CSS).
StartsWith still has use for quick things though, which doing with regex will look messy.
I learnt through DDG searches but I found a resource that outlines things nicely @ and I use this site to text complex regex patterns @.
Edit: I am more than happy to help with regex patterns as they can get complex, message me on the forums #.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
best bot ever
You must be trolling with that regex. It's overkill for comparing the first char to 3 things and is probably more performance-intensive than 3 StartsWith()s - it's certainly much less readable.
I would leave your code how it was, but if you want to add more prefixes it will be easier to do:
if (new char[] { '!', '.', '@' }.Contains(m.GetString(1)[0]) { ... }
This creates a char array and fills it with the command prefixes you want. It then checks if the array contains the first character of the chat message, so if the chat message starts with a command prefix (! . @), the statement returns true.
One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.
Offline
You must be trolling with that regex. It's overkill for comparing the first char to 3 things and is probably more performance-intensive than 3 StartsWith()s - it's certainly much less readable.
I would leave your code how it was, but if you want to add more prefixes it will be easier to do:
if (new char[] { '!', '.', '@' }.Contains(m.GetString(1)[0]) { ... }
This creates a char array and fills it with the command prefixes you want. It then checks if the array contains the first character of the chat message, so if the chat message starts with a command prefix (! . @), the statement returns true.
I did say it was overkill but the final one works perfectly for commands, accept any punctuation and with no effort I now have the command used alone without the punctuation, it's useful to be able to fully parse a command - may as well have the best solution early on.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
You must be trolling with that regex. It's overkill for comparing the first char to 3 things and is probably more performance-intensive than 3 StartsWith()s - it's certainly much less readable.
It's perfectly acceptable to use low-performance code in applicable scenarios, such as this, nor is it unreadable to anyone that knows regular expressions.
*u stinky*
Offline
Regex indeed is very intensive, mostly compiling them (or so I hear on work). In case you do want to use regex: Compile them beforehand (put them in a Regex object), and obviously don't do this compilation inside any loop, since then you'd compile them over and over again instead of just once. Compilation over regex' are very resource intensive (obviously using them too, but it'll only get significant when they're very complex or are applied on large portions of text).
Anyways, if you would want to micro-optamize but keep regex, I think this regex would be more efficient, mostly on the compile side: ^\W
Matches everything except ranges "a-z", "A-Z", "0-9" and the "_" character. If you'd want to also include "_" it'd simply be: ^(\W|_)
Would also increase readability to use \w instead of all those alphanumeric ranges, in my opinion. And I'd also use \s+ just in case somebody's an idiot and places multiple spaces...
Btw, Koya, why do you limit the user to just alphanumeric characters in their command messages? They can't even put a good-grammar "." and the end of a report message! D:
Offline
It's completely nonsensical to get worked up over the performance costs of using regular expressions in this scenario, because it's utterly negligible.
*u stinky*
Offline
Regex indeed is very intensive, mostly compiling them (or so I hear on work). In case you do want to use regex: Compile them beforehand (put them in a Regex object), and obviously don't do this compilation inside any loop, since then you'd compile them over and over again instead of just once. Compilation over regex' are very resource intensive (obviously using them too, but it'll only get significant when they're very complex or are applied on large portions of text).
Anyways, if you would want to micro-optamize but keep regex, I think this regex would be more efficient, mostly on the compile side: ^\W
Matches everything except ranges "a-z", "A-Z", "0-9" and the "_" character. If you'd want to also include "_" it'd simply be: ^(\W|_)Would also increase readability to use \w instead of all those alphanumeric ranges, in my opinion. And I'd also use \s+ just in case somebody's an idiot and places multiple spaces...
Btw, Koya, why do you limit the user to just alphanumeric characters in their command messages? They can't even put a good-grammar "." and the end of a report message! D:
Commands do not include numbers, anywhere; you can add them by all means.
I use Regex because with one variable I now have the command without the punctuation and all values in the message, it simplifies and keeps the code cleaner; this process is run for each command and not 10 times a second.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
Commands do not include numbers, anywhere; you can add them by all means.
I was more pointing at the parameter part: ^[^a-zA-Z0-9]([A-Za-z])+\b( [A-Za-z0-9]+)*
So first off: Perhaps sometimes you would like to use numbers? I mean, can't hurt to implement the functionality.
Also, why the /b? the white space already takes care of that.
But yeah, currently the parameters wouldn't be very "message" friendly. For example the report feature: can't use "&" or "." or "!" or "(" etc.
So I'd personally use a regex like:
^(\W|_)\w+(\s+\S+)*)
EDIT: also thought of a bug with your current regex regarding special characters, but nevermind.
Offline
What new features are you going to add to this bot?
I'll answer it anyways.
I'll try to add new features but I don't get time.
Right now, I'm not doing anything because I'm busy with other things.
When I do get time, I'll try to add a fill tool which lets you fill blocks in a rectangular area between 2 co-ordinates. And a digbot once I get my hands on Processor's deserialization tool.
best bot ever
Thanks
It's completely nonsensical to get worked up over the performance costs of using regular expressions in this scenario, because it's utterly negligible.
Not on the PC I use. I take more than 2 minutes to compile my code. I work on a potato.
Offline
XxAtillaxX wrote:It's completely nonsensical to get worked up over the performance costs of using regular expressions in this scenario, because it's utterly negligible.
Not on the PC I use. I take more than 2 minutes to compile my code. I work on a potato.
We're talking about run-time optimizations
Beside the fact that it's very hard to optimize compilation time, it's way more important to focus on the run speed.
Offline
Sorry to bump this. But I was reading the readme and found this.
<For security nerds> Bot1448 doesn't collect any of your data. You can be a 100% safe when you use Bot1448.</For security nerds>
Still you save the email and password in settings.dat.
Offline
Sorry to bump this. But I was reading the readme and found this.
<For security nerds> Bot1448 doesn't collect any of your data. You can be a 100% safe when you use Bot1448.</For security nerds>
Still you save the email and password in settings.dat.
I think will collecting he meant something ninja once did with his bot. Actually mining data and putting it on HIS pc instead of the one of the user.
The bot is entirely safe to use when all data is saved locally. The person might be less safe when another person get access to said file.
Obviously encrypting the data would be BETER... But the bot is still doesn't do anything freaky with your data.
Offline
[ Started around 1743510352.0992 - Generated in 0.266 seconds, 11 queries executed - Memory usage: 1.9 MiB (Peak: 2.23 MiB) ]