Closed SigmaPopsi closed 1 year ago
Seems like it's this line I put in just to test if the bot is working:
await Context.Channel.SendMessageAsync($"{user.Mention} said {Msg.Content} in {contextChannel}! Hello!! Ping me to get a LLM response from your LLM! You can remove this line of code to stop me talking.");
My guess is you need to enable Message intents in your Discord developer portal. https://autocode.com/discord/threads/what-are-discord-privileged-intents-and-how-do-i-enable-them-tutorial-0c3f9977/
Without those intents all enabled, the bot is not allowed to read any of the message content and other such info it needs, and it could cause that issue.
Try that and see if it works.
This is my bot Mlem he's cute.
I've enabled all of the privileged gateway intents, still nothin'.
Here's some of the code from 175 to 200, any idea what might be the cause?
` private async Task Client_MessageReceived(SocketMessage MsgParam) // this fires upon receiving a message in the discord { try { var Msg = MsgParam as SocketUserMessage; var Context = new SocketCommandContext(Client, Msg); var user = Context.User as SocketGuildUser; var contextChannel = Context.Channel as SocketGuildChannel; // used if you want to select a channel for the bot to ignore or to only pay attention to
if (thinking <= 0 // only run if the bot is not typing or "thinking" still (aka: this code only runs 1 prompt at a time)
&& typing <= 0
&& Msg.MentionedUsers.Contains(MainGlobal.Server.GetUser(1088404692909965353))) // only run the code if you mentioned the bot
// && (contextChannel.Id == channel_id_here) // you can uncomment this if you want it to only see one channel. put in the channel ID there.
{
thinking = 2; // set thinking to 2 to make sure no new requests come in while it is generating (it scrambles the outputs together)
LlamaReply(Msg, Context); // run the LlamaReply function to reply to the user's message
await Context.Channel.SendMessageAsync($"{user.Mention} said {Msg.Content} in {contextChannel}! Hello!! Ping me to get a LLM response from your LLM! You can remove this line of code to stop me talking."); // remove this once you confirm the bot is working
}
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
}
}
private void LlamaReply(SocketMessage message, SocketCommandContext context)
{`
Damn this code fucked up MB
Unless you modified it, it shouldn't be giving you an error. Did you make sure to install all of the packages? Check to make sure your Program.cs
is up to date. Also go through and modify any ID's that are different for your server as compared to DeSinc's.
I'm having this issue too - it seems to be originating from here.
if I comment out the last highlighted line, the bot works but then it starts talking to itself
same issue here too that's originating from the same line of code as joebobbio mentioned
Make sure your intents are set in the bot dev portal. See the main github sallybot page, the readme that I updated, for the updated instructions. https://autocode.com/discord/threads/what-are-discord-privileged-intents-and-how-do-i-enable-them-tutorial-0c3f9977/
I fixed the bug guys, download the updated code and replace in your bot ID, and ALSO YOUR SERVER ID now. There are big caps lock words that will error out in the IDE to show you where to put your IDs. Replace these IDs with your server and bot IDs.
System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=sallybot Ślad stosu: w SallyBot.Program.d__12.MoveNext() w C:\Users\matth\Downloads\SallyBot\Program.cs:wiersz 193
I must say im not really familiar with C, and i can't wrap my head around what i am doing wrong. I feel like i'm going insane i've sat there for the past 3 hours trying to get it to work yet nothin. Someone help me, please. The CMD starts normally, the problem is whenever i send a message in a channel, "Object reference not set to an instance of an object." pops up and the bot doesn't even respond.