twitch properly sets up self account
Some checks failed
gitea.arg.rip/vassago/pipeline/head There was a failure building this commit

This commit is contained in:
adam 2024-12-26 17:27:35 -05:00
parent 4c93fd3ef8
commit 4c06a74410
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -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