How to create a Discord bot in C# that sends random text followed by a random image

I want to build a Discord bot that can do two things at once. First, it should pick a random message from a list of pre-written messages. Then right after that message, it should post a random image from a collection of image URLs.

I have seen other bots do this where they combine random text with random pictures in the same response. The idea is to have the bot choose different combinations each time it runs.

Can someone help me figure out how to set this up? I need the bot to select from multiple text options and multiple image options randomly.

Use the Discord.Net library - it makes this way easier. Create two arrays: one for your text messages and another for your image URLs. Then use the Random class to pick from both arrays so you can send a random text with a random image together. I’d recommend using EmbedBuilder to make it look clean. Set your random text as the description and use SetImageUrl for the image. Make sure your URLs are direct image links or you’ll get broken images (learned that the hard way). Also, add a small delay between selections if you want to avoid repeats when people spam the command.

Had this same issue when I started. You need proper random seeding or you’ll keep getting the same combinations over and over. Set up your Random object once when the bot starts - don’t create it inside the command method. Put your messages in one string array and images in another, then use random.Next() to grab indices from both. For sending, use ChannelExtensions.SendMessageAsync() with your random text, then call SendFileAsync() right after if you’re uploading files. Or just embed the image URL in the same message. Watch out for rate limiting though - users love spamming these commands. I’d add a cooldown timer per user so Discord doesn’t throttle your bot.

just put ur messages and image URLs in separate lists, then use random.next() to grab random indexes from each. discord.net handles everything - you can bundle text and image in one embed or send them separately. dont overthink it, took me maybe 20 mins to get mine working.

The hardest part isn’t random selection - that’s just basic Random.Next(). The real headache starts when you need to track sent combinations, add scheduling, or pull content from different sources.

I found this out building notification bots that needed dynamic content. You can hardcode message arrays and URLs, but what about weighted randomization? Pulling images from Google Drive? Avoiding duplicate combos back-to-back?

Don’t wrestle with Discord.Net and random logic - automate the whole workflow instead. Set up triggers that grab content from spreadsheets, apply smart randomization, then push everything to Discord automatically.

This scales much better. A/B testing different messages? Easy. Multiple image sources? Already covered. Random posting intervals? Built in.

I’ve watched too many Discord bots break when requirements shift. Skip the headache and use proper automation from day one.

Check out Latenode for this: https://latenode.com

Been there with Discord bots. The combo approach works but managing random selections and media gets messy quick.

Skip coding the random logic and Discord API calls from scratch - automate the whole thing instead. Set up triggers that pull random text from your messages, grab random images from your URLs, then fire both to Discord.

Best part? You can expand later without touching code. More message variations? Update your data. Different image categories? Add them to the flow. Random scheduling? Already built in.

I’ve done similar social media automation and it beats hardcoding everything. You get randomization, Discord integration, plus conditions like avoiding duplicate combos.

Check out Latenode for this kind of automation: https://latenode.com