patrickklaeren / Accord

A C# Discord bot with moderation, XP/guild participation and utilities
MIT License
15 stars 8 forks source link

Features & Bug fixes #25

Closed ProIcons closed 3 years ago

ProIcons commented 3 years ago
ProIcons commented 3 years ago

i Replaced the default Command Responder and Interaction responder for 2 main reasons. The first is to be able to not process commands while bot is initializing i.e caching data on startup. and the second reason to properly handle Error IResults.

I have my doubts about the parallel caching. Meaning if the bot ever gets into many many guilds that would cause a problem with rate limits. However my Testing Bot is on 10 servers and everything ran ok.

ProIcons commented 3 years ago

What's the purpose behind the scoped cache? I assume you just need a cache to use during a scope? But then it seems to only be reliant on the underlying singleton?

It's only for easier accessibility for the cached entries of the guild the command triggered for. It can be used only with CommandContext, and it lets you omit entirely the guildid on the request. However because it extends from the DiscordCache, it gives you the ability to search for other guilds as well.

for example you want to take the GuildMember of the current user instead of doing

_discordCache.GetGuildMember(_commandContext.GuildID.Value.Value, _commandContext.User.ID.Value);

you can simply use

_discordCache.GetInvokingGuildMember();

which is less verbose.