jsdelivr / globalping

A global network of probes to run network tests like ping, traceroute and DNS resolve
https://globalping.io
263 stars 33 forks source link

Implement a Discord bot for usability #397

Open 6ixfalls opened 1 year ago

6ixfalls commented 1 year ago

Hi! Read jimaek's post on LET, and wanted to provide my take on a globalping Discord bot.

Discord bots primarily revolve around slash commands, in which there should be one slash command for each task (/ping, /traceroute, /mtr, etc.) Alternatively, you could also have one single /globalping command, which has an argument for which command to run (similar to the Slack and GitHub integrations, although personally I'd prefer having a command for each type rather than one command with options.) These commands would also have arguments like the Slack commands, in which the target can be made required while the "from" and "limit" arguments can be optional (and default to Global and a set default limit). In addition, the from argument can also be autocompleted, giving users an easier way to select the correct source.

For responses, rich embeds are definitely the way to go. Cloudflare has a DNS over Discord bot, which uses rich embeds to display results. The initial run of the command should result in a deferReply call, in which Discord will show the message " is thinking...", which would likely be a good indicator that the task is in progress. For sending results, a rich embed with a field for every source would be nice.

In addition, there could also be a button at the bottom of the embed for viewing the full results. The above embed was based on this test post https://github.com/jsdelivr/globalping/issues/393#issuecomment-1634385801, which contains a message and link at the end to view the full results. You can use a button with the Link style for that, even though the link is already in the title of the embed, not everyone will know to click it. The source of the above embed is here.

In theory, there are many different ways to integrate globalping as a Discord bot. Cloudflare integrates their DNS service as a Discord bot by using one big codeblock for all information, which globalping could use as well.

Finally, for "promoting", there isn't much you'd need to do. For one, you can add it alongside the Slack integration in the Globalping website, and if you'd like, add it to a few discord bot lists (https://top.gg/), for example. In addition, you'd also likely want to verify the bot to invite it to move than 100 servers, which would require you to provide your ID to Discord through Stripe verification and a monthlong process.

Thanks for reading, feel free to comment and modify the theming and layout at will!

jimaek commented 1 year ago

Thank you for this detailed issue! We will make sure to get your feedback during the development process :)