diff --git a/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs b/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs index 855a785..4f99112 100644 --- a/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs +++ b/ProtocolInterfaces/TwitchInterface/TwitchInterface.cs @@ -139,10 +139,11 @@ public class TwitchInterface private async void Client_OnConnected(object sender, OnConnectedArgs e) { + Console.WriteLine($"twitch marking selfaccount as seeninchannel {protocolAsChannel.Id}"); var selfAccount = UpsertAccount(e.BotUsername, protocolAsChannel.Id); + Behaver.Instance.MarkSelf(selfAccount); await _db.SaveChangesAsync(); - Behaver.Instance.MarkSelf(selfAccount); Console.WriteLine($"Connected to {e.AutoJoinChannel}"); } @@ -159,10 +160,12 @@ public class TwitchInterface private Account UpsertAccount(string username, Guid inChannel) { + var seenInChannel = _db.Channels.FirstOrDefault(c => c.Id == inChannel); var acc = _db.Accounts.FirstOrDefault(ui => ui.ExternalId == username && ui.SeenInChannel.Id == inChannel); if (acc == null) { acc = new Account(); + acc.SeenInChannel = seenInChannel; _db.Accounts.Add(acc); } acc.Username = username; diff --git a/README.md b/README.md index b57cd67..ca9e08f 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ that's read messages/view channels, send messages, send messages in threads, and ### Accounts -a `User` can have multiple `Account`s. e.g., @adam:greyn.club? that's an "account". I, however, am a `User`. An `Account` has references to the `Channels` its seen in. +a `User` can have multiple `Account`s. e.g., @adam:greyn.club? that's an "account". I, however, am a `User`. An `Account` has references to the `Channels` its seen in - as in, leaf-level. If you're in a subchannel, you'll have an appropriate listing there - i.e., you will never have an account in "discord (itself)", you'll have one in the guild text-channels ### Attachment -debating whether to save a copy of every single attachment. Discord allows 25MB attachments, and shtikbot lives in several art channels. +debating whether to save a copy of every single attachment. Discord allows 100MB attachments for turbo users, and shtikbot lives in several art channels. (unfortunately, being that shtikbot doesn't have a viable SMS spam vector, it's limited to 8MB, in contradiction to discord itself reporting a server that doesn't agree to put its own name on discord's finer-grained rules has a limit of 10MB) ### Channel