C
C#10mo ago
Sevas

✅ Discord Bot / Commands dosent work

Hello everyone who reads this, i am a newbie with programming (i only know the basics) and i started to program a discord bot 2-3 days ago, with the help of an older guide, the bot goes online but the test command dosent work, could someone help me? (and sorry for my bad english its not my native language)
No description
No description
No description
No description
34 Replies
Angius
Angius10mo ago
That GetAwaiter().GetResult() seems sus That said, which Discord library are you using?
Sevas
SevasOP10mo ago
wait a sec Discord.Net
Angius
Angius10mo ago
It seems like you're adding some async methods as event handlers Async and events don't mix
The Fog from Human Resources
You should consider using the Interaction framework for slash commands
Angius
Angius10mo ago
Doesn't seem like you're really following the docs either
The Fog from Human Resources
Message commands are deprecated pretty much
Angius
Angius10mo ago
Try following the docs exactly before you try straying
The Fog from Human Resources
This is also pretty easy to do after the step of adding the interaction handler Its just [SlashCommand("")] instead of [Command("")] But do as @/angius said and follow the docs otherwise it'll be hell to implement anything
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Sevas
SevasOP10mo ago
it may looks dumb now, but what are these docs? the guide was a video and i followed every step
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Sevas
SevasOP10mo ago
thx
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Sevas
SevasOP10mo ago
thank you very much (again)
The Fog from Human Resources
Also remember.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Angius
Angius10mo ago
But first go back to the "getting started" section
Angius
Angius10mo ago
And get rid of this
No description
Anu6is
Anu6is10mo ago
this issue was most likely due to missing the Message Content intent
Sevas
SevasOP10mo ago
completly?
Angius
Angius10mo ago
No, just make it according to the docs
Sevas
SevasOP10mo ago
okay 👍
Angius
Angius10mo ago
The issue with the current code? Most likely this
No description
Angius
Angius10mo ago
BotReadyGame is an async method Events can't really handle async methods, so it's probably just being fired and forgotten
Sevas
SevasOP10mo ago
i will give you guys so fast as possible an update later so i started a new programm and followed the steps from the docs, but now the bot dosent even come on, and i got an error who saids, it dosent find an entry point for the main static mathode and i have no idea why
Sevas
SevasOP10mo ago
No description
SinFluxx
SinFluxx10mo ago
$mains
MODiX
MODiX10mo ago
The possible signatures for Main are
public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }
public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }
public is not required (can be any accessibility). Top-level statements are compiled into a Main method and will use an appropriate signature depending on the body. https://docs.microsoft.com/en-US/dotnet/csharp/fundamentals/program-structure/main-command-line
Main() and command-line arguments - C#
Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
SinFluxx
SinFluxx10mo ago
Your Main method signature has to be one of those (i.e. you're missing static)
Sevas
SevasOP10mo ago
thanks it worked
MODiX
MODiX10mo ago
Use the /close command to mark a forum thread as answered
Sevas
SevasOP10mo ago
sorry it probably cowardly from mine side, but i will switch to dsharp, it looks easier for me
Want results from more Discord servers?
Add your server