Add a sample for getting the Guild from an IMessage
some users were having trouble with this
This commit is contained in:
@@ -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
docs/guides/samples/faq/guild_from_message.cs
Normal file
4
docs/guides/samples/faq/guild_from_message.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
public async Task MessageReceived(IMessage msg)
|
||||
{
|
||||
var guild = (msg.Channel as IGuildChannel)?.Guild;
|
||||
}
|
||||
Reference in New Issue
Block a user