© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
17 replies
.Dja8x~

Discord.net

is this code correct ?
using System;
using Discord;
using Discord.Webhook;
using Discord.WebSocket;
using Discord.Commands;
using Events;
using System.Reflection;


public class Program {

    public DiscordSocketClient? Client;
    private DiscordSocketConfig GetSerpentConfig() {

        return new DiscordSocketConfig() {GatewayIntents = GatewayIntents.All};
    }
    public async Task MainAsync() {
        string Token = "MY_ACTUAL_BOT_TOKEN";

        Client = new DiscordSocketClient(GetSerpentConfig());
        
        Client.Log += Events.Logging.Log;
        Client.Ready += Events.Logging.Ready;
        Client.MessageReceived += Events.Messaging.MessageReceive;
        Client.InteractionCreated += Events.Logging.HandleInteractions;

        await Client.LoginAsync(TokenType.Bot,Token);

        await Client.StartAsync();

        await Task.Delay(-1);

    }
    public static Task Main() => new Program().MainAsync();



};
using System;
using Discord;
using Discord.Webhook;
using Discord.WebSocket;
using Discord.Commands;
using Events;
using System.Reflection;


public class Program {

    public DiscordSocketClient? Client;
    private DiscordSocketConfig GetSerpentConfig() {

        return new DiscordSocketConfig() {GatewayIntents = GatewayIntents.All};
    }
    public async Task MainAsync() {
        string Token = "MY_ACTUAL_BOT_TOKEN";

        Client = new DiscordSocketClient(GetSerpentConfig());
        
        Client.Log += Events.Logging.Log;
        Client.Ready += Events.Logging.Ready;
        Client.MessageReceived += Events.Messaging.MessageReceive;
        Client.InteractionCreated += Events.Logging.HandleInteractions;

        await Client.LoginAsync(TokenType.Bot,Token);

        await Client.StartAsync();

        await Task.Delay(-1);

    }
    public static Task Main() => new Program().MainAsync();



};
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Discord.Net
C#CC# / help
2mo ago
Error discord.net bot
C#CC# / help
2mo ago
Discord.Net + MagicOnion, heheh
C#CC# / help
3y ago
❔ Discord.Net autocompletion VSCode
C#CC# / help
4y ago