mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat: don't try to match other systems' members in switch / group add commands
This commit is contained in:
parent
dec228d5bd
commit
a2bf70b395
4 changed files with 22 additions and 17 deletions
|
|
@ -17,8 +17,11 @@ namespace PluralKit.Core
|
|||
public Task<PKGroup?> GetGroupByDisplayName(IPKConnection conn, SystemId system, string display_name) =>
|
||||
conn.QueryFirstOrDefaultAsync<PKGroup?>("select * from groups where system = @System and lower(display_name) = lower(@Name)", new { System = system, Name = display_name });
|
||||
|
||||
public Task<PKGroup?> GetGroupByHid(IPKConnection conn, string hid) =>
|
||||
conn.QueryFirstOrDefaultAsync<PKGroup?>("select * from groups where hid = @hid", new { hid = hid.ToLowerInvariant() });
|
||||
public Task<PKGroup?> GetGroupByHid(IPKConnection conn, string hid, SystemId? system = null)
|
||||
=> conn.QueryFirstOrDefaultAsync<PKGroup?>(
|
||||
"select * from groups where hid = @hid" + (system != null ? " and system = @System" : ""),
|
||||
new { hid = hid.ToLowerInvariant(), System = system }
|
||||
);
|
||||
|
||||
public Task<int> GetGroupMemberCount(IPKConnection conn, GroupId id, PrivacyLevel? privacyFilter = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -11,8 +12,11 @@ namespace PluralKit.Core
|
|||
public Task<PKMember?> GetMember(IPKConnection conn, MemberId id) =>
|
||||
conn.QueryFirstOrDefaultAsync<PKMember?>("select * from members where id = @id", new { id });
|
||||
|
||||
public Task<PKMember?> GetMemberByHid(IPKConnection conn, string hid) =>
|
||||
conn.QuerySingleOrDefaultAsync<PKMember?>("select * from members where hid = @Hid", new { Hid = hid.ToLower() });
|
||||
public Task<PKMember?> GetMemberByHid(IPKConnection conn, string hid, SystemId? system = null)
|
||||
=> conn.QuerySingleOrDefaultAsync<PKMember?>(
|
||||
"select * from members where hid = @Hid" + (system != null ? " and system = @System" : ""),
|
||||
new { Hid = hid.ToLower(), System = system }
|
||||
);
|
||||
|
||||
public Task<PKMember?> GetMemberByName(IPKConnection conn, SystemId system, string name) =>
|
||||
conn.QueryFirstOrDefaultAsync<PKMember?>("select * from members where lower(name) = lower(@Name) and system = @SystemID", new { Name = name, SystemID = system });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue