C
C#4mo ago
Apollo

✅ 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
Angius4mo ago
That GetAwaiter().GetResult() seems sus That said, which Discord library are you using?
Apollo
Apollo4mo ago
wait a sec Discord.Net
Angius
Angius4mo ago
It seems like you're adding some async methods as event handlers Async and events don't mix
Waffles from Human Resources
You should consider using the Interaction framework for slash commands
Angius
Angius4mo ago
Doesn't seem like you're really following the docs either
Waffles from Human Resources
Message commands are deprecated pretty much
Angius
Angius4mo ago
Try following the docs exactly before you try straying
Waffles 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 User4mo ago
Message Not Public
Sign In & Join Server To View
Apollo
Apollo4mo ago
it may looks dumb now, but what are these docs? the guide was a video and i followed every step
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Apollo
Apollo4mo ago
thx
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Apollo
Apollo4mo ago
thank you very much (again)
Waffles from Human Resources
Also remember.
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
Angius
Angius4mo ago
But first go back to the "getting started" section
Angius
Angius4mo ago
And get rid of this
No description
Anu6is
Anu6is4mo ago
this issue was most likely due to missing the Message Content intent
Apollo
Apollo4mo ago
completly?
Angius
Angius4mo ago
No, just make it according to the docs
Apollo
Apollo4mo ago
okay 👍
Angius
Angius4mo ago
The issue with the current code? Most likely this
No description
Angius
Angius4mo ago
BotReadyGame is an async method Events can't really handle async methods, so it's probably just being fired and forgotten
Apollo
Apollo4mo 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
Apollo
Apollo4mo ago
No description
SinFluxx
SinFluxx4mo ago
$mains
MODiX
MODiX4mo 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
SinFluxx4mo ago
Your Main method signature has to be one of those (i.e. you're missing static)
Apollo
Apollo4mo ago
thanks it worked
MODiX
MODiX4mo ago
Use the /close command to mark a forum thread as answered
Apollo
Apollo4mo ago
sorry it probably cowardly from mine side, but i will switch to dsharp, it looks easier for me