An open API service indexing awesome lists of open source software.

https://github.com/defxult/discord.cs


https://github.com/defxult/discord.cs

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# discord.cs



An in development Discord API library written in C#.




## Discord
Join the official [Discord server](https://discord.gg/6TNJHcGRYv) for discord.cs! Get support, updates/announcements, and contribute to development.

## NuGet
Discord.cs is on [NuGet](https://www.nuget.org/packages/Discord.cs/). In the early stages of development, any help testing the library is appreciated!

## Basic Usage
```csharp
// The following simply brings your bot online and responds to a message.

using Discord;
using Discord.Models;

// Set your bot token.
Environment.SetEnvironmentVariable("DISCORD_BOT_TOKEN", "");
var bot = new Bot(Intents.Default);

// Listen for messages.
bot.Events.OnMessageCreate += async (_, message) =>
{
// Don't respond to bot messages (ourselves) to avoid a loop.
if (message.Author.IsBot)
return;

if (message.Content == "hi")
await message.Channel.SendAsync("Hello! 👋")
};

await bot.ConnectAsync();
await Task.Delay(-1);
```