Skip to content

Conversation

@null8626
Copy link
Member

The following pull request is a toned down version of #29. This pull request focuses solely on adding an actual automatic adapter for Discord.NET (a.k.a. autoposter.)

Copy link
Contributor

@velddev velddev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems incomplete

Comment on lines +28 to +31
public virtual Task RunAsync()
{
throw new NotImplementedException();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional?

Copy link
Member Author

@null8626 null8626 Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended to be implemented by this class' child classes. In this case, SubmissionAdapter.

Adapter's role is to implement the actual Task loop that does the autoposting, regardless of Discord bot library-specific implementation. It implements the IAdapter interface which is from DiscordBotsList.Api.Objects.

SubmissionAdapter's role is to implement Discord.NET-specific operations, or in this case await api.UpdateBotServerCountAsync((await client.GetGuildsAsync()).Count);

SubmissionAdapter is lifted from the older version of the SDK, it was an internal class so I made it public.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapter's role is to implement the actual Task loop that does the autoposting, regardless of Discord bot library-specific implementation. It implements the IAdapter interface which is from DiscordBotsList.Api.Objects.

Okay makes sense. I would recommend using a BackgroundWorker then. https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.backgroundworker?view=net-9.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These adapters were a part of the old version of the SDK, but an automatic implementation that does it did not exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapter's role is to implement the actual Task loop that does the autoposting, regardless of Discord bot library-specific implementation. It implements the IAdapter interface which is from DiscordBotsList.Api.Objects.

Okay makes sense. I would recommend using a BackgroundWorker then. https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.backgroundworker?view=net-9.0

Sure.

Copy link
Member Author

@null8626 null8626 Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


namespace DiscordBotsList.Api.Adapter.Discord.Net
{
public class Adapter : IAdapter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't really understand what this does? Why not just use BackgroundWorker?

Copy link
Member Author

@null8626 null8626 Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants