0

Im getting an error with this code

the code is : using Discord; using Discord.Commands; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GODbot { class mybot { DiscordClient discord; CommandService commands; Random rand; public mybot() { discord = new DiscordClient(x => { x.LogLevel = LogSeverity.Info; x.LogHandler = log; }); discord.UsingCommands(x => { x.PrefixChar = '!'; x.AllowMentionPrefix = true; }); var commands = discord.GetService<CommandService>(); commands.CreateCommand("hello") .Do(async (e) => { await e.Channel.SendMessage("Hi Bitch!"); }); discord.ExecuteAndWait(async () => { await discord.Connect("MjU3MzU3MDUyODcwMDAwNjQx.Cy6I1Q.mSEtStNr7APKG-RvjB9-xmJRndk", TokenType.Bot); }); } private void log(object sender, LogMessageEventArgs e) { Console.WriteLine(e.Message); } } } and it keeps giving me the error: Error CS5001 Program does not contain a static 'Main' method suitable for an entry

11th Dec 2016, 5:27 PM
Nick Prezeau
Nick Prezeau - avatar
7 odpowiedzi
0
It means you don't have a main method.
12th Dec 2016, 3:21 AM
Gabe Maxfield
Gabe Maxfield - avatar
0
ik that it requires the static main type but i dont know the exact thing to do to fix it
12th Dec 2016, 3:33 AM
Nick Prezeau
Nick Prezeau - avatar
0
Try: int main(){ return 0; }
12th Dec 2016, 3:35 AM
Gabe Maxfield
Gabe Maxfield - avatar
0
The main gives the program a place to start. If you add it your code should compile but it won't do anything unless you add stuff to the main.
12th Dec 2016, 3:36 AM
Gabe Maxfield
Gabe Maxfield - avatar
0
Wait what language is this? It looks like c++ and javascript. This looks mostly like c++ but the line "var commands = ..." Is javascript. You might need to check through everything. Good luck!
12th Dec 2016, 3:37 AM
Gabe Maxfield
Gabe Maxfield - avatar
0
ight ill try it later
12th Dec 2016, 3:37 AM
Nick Prezeau
Nick Prezeau - avatar
0
^Gabe it's not c++ nor Javascript. It's C#. And Nick, remember every program in C++, Java and C# needs entry point which is main function/method. In C# it looks like this: static void Main(string[] args) { //Here you can create instance of your class and // execute your program }
12th Dec 2016, 7:47 AM
Jakub Stasiak
Jakub Stasiak - avatar