Errors when message is sent #7

Closed
opened 2023-03-16 08:01:03 +00:00 by Matias314 · 3 comments
Matias314 commented 2023-03-16 08:01:03 +00:00 (Migrated from github.com)

Hello, every time I send a 3 digit code I receive this error message. Did I do something wrong?

2023-03-16 08:58:50       Event handler exception for event MESSAGE_CREATED thrown from System.Threading.Tasks.Task <<Main>$>b__4(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.MessageCreateEventArgs) (defined in Program+<>c__DisplayClass0_0)
2023-03-16 08:58:50       System.NullReferenceException: Object reference not set to an instance of an object.
2023-03-16 08:58:50          at TreinpositiesBot.PhotoSourceProvider.GetPhotoSources(DiscordChannel channel) in /src/Sources/PhotoSourceProvider.cs:line 17
2023-03-16 08:58:50          at Program.<>c__DisplayClass0_0.<<Main>$>b__4(DiscordClient unused, MessageCreateEventArgs args) in /src/Program.cs:line 173
2023-03-16 08:58:50          at Emzi0767.Utilities.AsyncEvent`2.InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode)
2023-03-16 08:58:50 fail: Program[0]
2023-03-16 08:58:50       Discord client error
2023-03-16 08:58:50       System.NullReferenceException: Object reference not set to an instance of an object.
2023-03-16 08:58:50          at List<PhotoSource> TreinpositiesBot.PhotoSourceProvider.GetPhotoSources(DiscordChannel channel) in /src/Sources/PhotoSourceProvider.cs:line 17
2023-03-16 08:58:50          at Task Program.<Main>$(string[] args)+(DiscordClient unused, MessageCreateEventArgs args) => { } in /src/Program.cs:line 173
2023-03-16 08:58:50          at async Task Emzi0767.Utilities.AsyncEvent<TSender, TArgs>.InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode)```
Hello, every time I send a 3 digit code I receive this error message. Did I do something wrong? ```2023-03-16 08:58:50 fail: DSharpPlus.BaseDiscordClient[104] 2023-03-16 08:58:50 Event handler exception for event MESSAGE_CREATED thrown from System.Threading.Tasks.Task <<Main>$>b__4(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.MessageCreateEventArgs) (defined in Program+<>c__DisplayClass0_0) 2023-03-16 08:58:50 System.NullReferenceException: Object reference not set to an instance of an object. 2023-03-16 08:58:50 at TreinpositiesBot.PhotoSourceProvider.GetPhotoSources(DiscordChannel channel) in /src/Sources/PhotoSourceProvider.cs:line 17 2023-03-16 08:58:50 at Program.<>c__DisplayClass0_0.<<Main>$>b__4(DiscordClient unused, MessageCreateEventArgs args) in /src/Program.cs:line 173 2023-03-16 08:58:50 at Emzi0767.Utilities.AsyncEvent`2.InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode) 2023-03-16 08:58:50 fail: Program[0] 2023-03-16 08:58:50 Discord client error 2023-03-16 08:58:50 System.NullReferenceException: Object reference not set to an instance of an object. 2023-03-16 08:58:50 at List<PhotoSource> TreinpositiesBot.PhotoSourceProvider.GetPhotoSources(DiscordChannel channel) in /src/Sources/PhotoSourceProvider.cs:line 17 2023-03-16 08:58:50 at Task Program.<Main>$(string[] args)+(DiscordClient unused, MessageCreateEventArgs args) => { } in /src/Program.cs:line 173 2023-03-16 08:58:50 at async Task Emzi0767.Utilities.AsyncEvent<TSender, TArgs>.InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode)```
Foxite commented 2023-03-16 08:35:59 +00:00 (Migrated from github.com)

appsettings.json contains a SourcesByGuild object that apparently becomes null when it's empty.

I'll push a fix shortly, for now you can just fill it in according to the example.

Another problem I discovered while investigating this, is that NoResultsEmote also causes an error when it's null, which it shouldn't.

appsettings.json contains a SourcesByGuild object that apparently becomes `null` when it's empty. I'll push a fix shortly, for now you can just fill it in according to the example. Another problem I discovered while investigating this, is that NoResultsEmote also causes an error when it's null, which it shouldn't.
Foxite commented 2023-03-16 08:41:48 +00:00 (Migrated from github.com)

It should be fixed in 0e1a7b8579. Please try it now.

It should be fixed in 0e1a7b8579f439e246a21cf6e58942a2858057cd. Please try it now.
Matias314 commented 2023-03-16 08:54:49 +00:00 (Migrated from github.com)

Hello, thanks for the quick response! That mitigates the error but I'm not getting a response back, and no error either. Is there some additional setup I need to do to the sources besides the example? Are the IDs channel or guild IDs? I've tried both.

Never mind, it works with the defaults. Thank you!

~~Hello, thanks for the quick response! That mitigates the error but I'm not getting a response back, and no error either. Is there some additional setup I need to do to the sources besides the example? Are the IDs channel or guild IDs? I've tried both.~~ Never mind, it works with the defaults. Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Foxite/TreinpositiesBot#7
No description provided.