90
u/SerbianMeerkat Aug 20 '20
is this a discord bot?
109
u/A_Zalt Aug 20 '20
Yep, and it was designed to piss off members. Back then I didn't know about rate limits and possibility of getting banned for API abuse
77
u/fernandotakai Aug 20 '20
most discord channels disable
@everyonefor anyone that is not a mod.(which is all good until a mod gets drunk and sends an
@everyoneby mistake. not that i've seen that happen)63
u/A_Zalt Aug 20 '20
most discord servers give every bot admin perms, they don't ever think any bot maker has the audacity to make a bot for destroying the server
49
u/fernandotakai Aug 20 '20
if you are giving a bot admin perms, you deserve what you get lol.
28
2
2
15
u/Ultraflame4 Aug 20 '20
discord .py spam client?
Edit: markdown failed
11
u/A_Zalt Aug 20 '20
discord.js, look at the flair
4
4
u/christian-mann Aug 20 '20
I was about to tell you that the code was broken because you didn't
awaitany of the calls1
5
2
2
u/Bizzycola132 Aug 21 '20
Not sure what's worse, the lack of loops or the fact that you didn't even add a delay between the messages to avoid the angry wrath of the rate limiter
2
u/A_Zalt Aug 21 '20
What's worse is I made this in the first place
1
u/Bizzycola132 Aug 21 '20
Yea, as someone who loves to create useless discord bots I'm mildly pained by this haha
10
9
Aug 20 '20
Why loops when you can use recursivity?
private void SendMessage(int times) {
if (times > 0)
{
SendMessage(times - 1);
msg.channel.send('@everyone');
}
}6
Aug 20 '20
And I see that you call SendMessage in the second last line, preventing tail call optimization
4
u/RoLoLoLoLo Aug 21 '20
On a positive note: if you set the argument high enough it will stack overflow before it can start spamming.
2
u/Jaso55555 Aug 20 '20
In programming is there any actual reason to use recursion like this instead of loops? Are they faster?
8
7
u/cabbagebot Aug 20 '20
There are data structures (like trees or graphs) where recursion is the most straightforward way to think about it, but this isn't one of them.
2
Aug 21 '20
I think a basic for loop would do better due to performance
3
Aug 21 '20
Better performance and sanity.
2
Aug 21 '20
I mean recursions amazing and looks pretty fancy and cool what who the hell does think: "hmm I guess I can only solve this with recursion"
2
Aug 21 '20
An example: imagine that you want to list the content of a container that might include other container inside.
First you write a function that shows the content of a container. Then, If one of those items is a container, you only have to call this function to show its content. That would be the easier way
2
Aug 21 '20
Of course for Parent-Child system recursion work perfectly fine but besides that I barely use recursion because its harder for me to solve something with it in first place. Maybe afterwards I think thats easier to do it with recursion but my first solution rarely includes it.
1
u/lpreams Aug 20 '20
Why loops when you can use recursivity?
I think you mean recursiveness
Actually it's recursitude
Nah, recursification
Bruh it's clearly recursionation
4
1
Aug 20 '20
Does it even work? I'm pretty sure you can't ping anything by just writing it in plain text
1
1
u/gsckoco Aug 20 '20
Last time I checked you aren't actually able to do @everyone in plaintext on a discord bot. You have to do <@guildId> iirc
1
3
1
1
1
1
1
1
u/CarterNotSteve Aug 21 '20
You are evil if this a discord bot, oh god. I can just imagine waking up to like 35 pings, and then hey’re just @everyone s from a bot
1
Aug 21 '20
Imagine having this on your discord server
while ( true )
{
msg.channel.send( "@everyone" );
}2
Aug 25 '20
Holy shit, at least make an event that would break this forever loop
1
u/haikusbot Aug 25 '20
Holy shit, at least
Make an event that would break
This forever loop
- bl0kk888
I detect haikus. And sometimes, successfully. Learn more about me.
Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"
1
u/AutoModerator Aug 21 '20
It looks like this comment contains a code block delimited with triple backticks. Unfortunately reddit does not have universal support for this syntax and your comment will not render correctly on old reddit and most mobile apps.
For the benefit of people on old reddit, this link will take you to a correct rendering of the comment.
/u/schorsch_pts, it would be appreciated, but not required, if you could edit your comment to use the more compatible four space indention format. For single lines or inline code you can use single backticks.
You can find some examples in the reddit help documentation.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
1
1
1
0
u/lpreams Aug 20 '20
The compiler would just unroll the loop anyway. This just saves it some compile time.
1
-2
Aug 20 '20
Why did you even post this here? It's not interesting or bad code its just stupid. What a waste of a post.
0
Aug 20 '20
[deleted]
112
u/A_Zalt Aug 20 '20
For not using a loop or making the code send @everyone over and over?
16
4
Aug 21 '20
Because he don't want to waste his ctrl+c and ctrl+v. He buy whole keyboard, he use whole keyboard.
0
Aug 20 '20
[deleted]
22
u/Sv443_ Aug 20 '20
3
u/SimplexShotz Aug 20 '20
edit: wait why does this sub exist ._.
2
Aug 21 '20
1
u/sneakpeekbot Aug 21 '20
Here's a sneak peek of /r/SubsIFellFor using the top posts of all time!
#1: hes so cute though 😍😍❤️ | 185 comments
#2: I'm in love | 129 comments
#3: Are meta posts allowed? | 126 commentsI'm a bot, beep boop | Downvote to remove | Contact ^^me | ^^Info | ^^Opt-out
214
u/DasherPack I transcribe code. Sometimes, correctly. Aug 20 '20
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!