izy521 / discord.io

A small, single-file library for creating DiscordApp clients from Node.js or the browser
https://discord.gg/0MvHMfHcTKVVmIGP
MIT License
535 stars 155 forks source link

Getting a server name by id? #304

Closed Charsy89 closed 5 years ago

Charsy89 commented 5 years ago

Hey, for one, here's some code. // Get a server ID based on channel ID // Note: this is being used in commands function getServerID(channelID) { bot.channels[channelID].guild_id; } function getServerName(serverID) { // ?? } Basically, I have my bot log certain commands (e.g. Admin commands). It currently only logs the server ID it was ran in (e.g. User JohnDoe3042 ran command !ping in server 000000000000000000) and I thought it would be better if it also logged the name of the server (e.g. User JohnDoe3042 ran command !ping in server "foobar hangout" (000000000000000000)), because who wants to copy a ton of server ids to see which one the command was ran in?

cloudrac3r commented 5 years ago

bot.servers[serverID].name

Feel free to join the official help server if you intend on asking more questions like this in future. https://discord.gg/0MvHMfHcTKVVmIGP

Charsy89 commented 5 years ago

Thanks!