Browse Source

Add a sample for getting the Guild from an IMessage

some users were having trouble with this
tags/1.0-rc
Christopher F 8 years ago
parent
commit
36d3257440
2 changed files with 9 additions and 1 deletions
  1. +5
    -1
      docs/guides/samples.md
  2. +4
    -0
      docs/guides/samples/faq/guild_from_message.cs

+ 5
- 1
docs/guides/samples.md 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)]

+ 4
- 0
docs/guides/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;
}

Loading…
Cancel
Save