Add a sample for getting the Guild from an IMessage

some users were having trouble with this
This commit is contained in:
Christopher F
2016-08-27 17:50:03 -04:00
parent 4e636f732d
commit 36d3257440
2 changed files with 9 additions and 1 deletions

View File

@@ -17,4 +17,8 @@ title: Samples
#### Sending a message to a channel
[!code-csharp[Message to Channel](samples/faq/send_message.cs)]
[!code-csharp[Message to Channel](samples/faq/send_message.cs)]
#### Retrieving an IGuild from an IMessage
[!code-csharp[Message to Guild](samples/faq/guild_from_message.cs)]

View File

@@ -0,0 +1,4 @@
public async Task MessageReceived(IMessage msg)
{
var guild = (msg.Channel as IGuildChannel)?.Guild;
}