public Diswords(DiswordsClient client, IGuildUser creator, JsonGuild guild, ITextChannel channel, bool createdNewChannel, int previousSlowModeInterval, JsonLanguage language) { Creator = creator ?? throw new ArgumentNullException(nameof(creator)); Channel = channel ?? throw new ArgumentNullException(nameof(channel)); Language = language ?? throw new ArgumentNullException(nameof(language)); Locale = ILocale.Find(Language.ShortName); Guild = guild; _newChannelCreated = createdNewChannel; _previousSlowModeInterval = previousSlowModeInterval; _client = client; _lastSender = null !; }
/// <summary> /// Method executed before the command. /// </summary> /// <param name="command">Discord.NET thing</param> /// <exception cref="Exception">Thrown if the client was not found.</exception> protected override void BeforeExecute(CommandInfo command) { //Find the client by it's ID //Diswords Client's ID is just Discord Bot's user ID. Client = DiswordsClient.Find(Context.Client.CurrentUser.Id); if (Client == default) { throw new Exception("Diswords: Something went wrong..\nDiswordsClient was not found."); } //Find the language of the server. Locale = ILocale.Find(Client.Guilds.FirstOrDefault(x => x.Id == Context.Guild.Id)?.Language); //Start "typing". _typing = Context.Channel.EnterTypingState(); base.BeforeExecute(command); }