❔ My discord bot Does work in DMs but servers
Today i wrote a simple C# bot in .NET framework.
It Works well in dms but it does not answer my commands in a server(btw im using prefix commands not slash ones)im pretty sure i turned on intents
Also while my bot is starting it says "You're using the GuildScheduledEvents gateway intent without listening to any events related to that Gateway. Consider removing the intent from your config"
I dont know what that means.
83 Replies
Out of curiosity - is there a reason you're using .NET Framework instead of .NET Core?
There is a #discord-dev channel that might be of help.
Um no?
Kk tysm!
You need to specifically tell the DiscordClient to use the Message intents
how?
one min let me fire up my project
Add the intents from here
Then start the client from that config
Ohh tysm!
So i make a new method
I mean
Share a snippet of your code
Where of it?
Where you start the client
I dont have a thing like that in my code
Program.cs
?Also
What Discord library are you using?
my
_client = new DiscordSocketClieny()
the parantes is empty
Discord.NET
In what method should i add that?Replace it with this
Ok tysm!!
Wait not that
It's not editing lol
Replace it with this
Ok i try that!
Tysm for help!
np
you're on .NET Framework so you need to include parentheses for initialisation:
highly suggest you migrate to new .NET versions and upgrade your language version
Ok!
Ty
And a problem
It does not recognize MessageCacheSize
i have no idea why
Am i missing a using or smth?
no just remove it
Probably has a different name
You're running an older version of the library
So its not necessary?
depends on your bot's functionalities
I found a class called MessageCache
It's probably that
But not a field
You should seriously reconsider your choice then, because .NET Framework is on maintenance mode and thus not receiving new features or being worked on anymore.
Is it supposed to be a class?
I know
If you know, then why did you...
I use .NET 8 most of the time
For everything
It's not really necessary but either way you should upgrade Discord.Net to 3.9 because the Discord API changes very often
Also please upgrade to .NET 7
.NET 8 is not even released yet
i mean .NET 7
Sorry
Im on 2022
Vs
I have to write all my codes again
?
I have .net 7
Already
Then you're not using .NET Framework
Can't judge but definitely not all of it
Some platform specific stuff will not be supported I think
My cousin told me to make sure its .net framework
Why?
Bc he was not used to new thing
Discord.net
Things
Well, your cousin is a dumbass.
oh:((
Example of migrating to the latest .NET - .NET
Learn how to migrate your applications from .NET 5, .NET Core, and .NET Framework to .NET 7.
Am i fucked up now?
No
doesn't take more than 30 minutes to migrate in my experience
I swear i have never used .net framework in my life but this time
There is literally no reason to use .NET Framework for new projects.
Some libraries don't even support it anymore. I don't know if that's the case for Discord.Net, but I do know it is for DSharpPlus and Remora.
WinForms, WPF, and UWP cough cough
Those all work on .NET Core.
So lemme try without that thing
The cachesize
Btw @OfType<T>()
They're not cross-platform so why would you deploy a self-contained 150mb copy to an end user when you can just do 10mb with .NET Framework?
Is the massagecachesize a field
??
That's a different discussion.
It is
yeah that's my point. I think newer .NET versions should always be shipped with Windows updates
Ok
So Windows users get 10mb binaries, but other platforms keep getting 60mb ones?
Ok lets see if it works
last I checked WinForms and WPF are not even cross-platform so
Oh right
Fair
Its connecting
NO WAY
The error is fixed
The error that i said upper
But it did not work
Wait maybe i should restart it
that was a warning not an error
make sure you're not filtering the MessageReceived event
Okay
Subscribe to the event like this
Place breakpoints on your
socketMessage
. See if its Content
property contains any value.So where should i put this code
I mean what method
Oh ok
Where you subscribe to the events
Look at this @OfType<T>()
If you're going to share code snippets you should make sure they are not full of typos
Did you type that in a word processor?
Place a breakpoint after
msg
. See if its Content
property is nullI didnt copy that code
Im on phone in my discord
$10 typed on a phone
crap
💵
I was one second late
Ok wait
Still does not work
obviously
that's the whole point of debugging
you need to check this
I tried that
and?
Is
Content
null?Wait
I searched in google and amd it said smth is wrong with my intent
Is that the code which activates the intents?
Yeah
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.