Minor renames and rewordings
This commit is contained in:
parent
50c9675963
commit
ccb6ba5d30
@ -313,27 +313,27 @@ namespace PluralKit.Bot
|
||||
}
|
||||
|
||||
public async Task SystemPing(Context ctx)
|
||||
{
|
||||
ctx.CheckSystem();
|
||||
|
||||
if (!ctx.HasNext())
|
||||
{
|
||||
if (ctx.System.Pings) {await ctx.Reply("Reaction pings are currently **enabled** for your system. To disable reaction pings, type `pk;s ping disable`.");}
|
||||
else {await ctx.Reply("Reaction pings are currently **disabled** for your system. To enable reaction pings, type `pk;s ping enable`.");}
|
||||
ctx.CheckSystem();
|
||||
|
||||
if (!ctx.HasNext())
|
||||
{
|
||||
if (ctx.System.PingsEnabled) {await ctx.Reply("Reaction pings are currently **enabled** for your system. To disable reaction pings, type `pk;s ping disable`.");}
|
||||
else {await ctx.Reply("Reaction pings are currently **disabled** for your system. To enable reaction pings, type `pk;s ping enable`.");}
|
||||
}
|
||||
else {
|
||||
if (ctx.Match("on", "enable")) {
|
||||
ctx.System.PingsEnabled = true;
|
||||
await _data.SaveSystem(ctx.System);
|
||||
await ctx.Reply("Reaction pings have now been enabled.");
|
||||
}
|
||||
if (ctx.Match("off", "disable")) {
|
||||
ctx.System.PingsEnabled = false;
|
||||
await _data.SaveSystem(ctx.System);
|
||||
await ctx.Reply("Reaction pings have now been disabled.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ctx.Match("on", "enable")) {
|
||||
ctx.System.Pings = true;
|
||||
await _data.SaveSystem(ctx.System);
|
||||
await ctx.Reply("Reaction pings have now been enabled.");
|
||||
}
|
||||
if (ctx.Match("off", "disable")) {
|
||||
ctx.System.Pings = false;
|
||||
await _data.SaveSystem(ctx.System);
|
||||
await ctx.Reply("Reaction pings have now been disabled.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<DateTimeZone> FindTimeZone(Context ctx, string zoneStr) {
|
||||
// First, if we're given a flag emoji, we extract the flag emoji code from it.
|
||||
|
@ -285,9 +285,16 @@ namespace PluralKit.Bot
|
||||
var requiredPerms = Permissions.AccessChannels | Permissions.SendMessages;
|
||||
if ((permissions & requiredPerms) != requiredPerms) return;
|
||||
|
||||
if (!msg.System.Pings) {
|
||||
await args.Channel.SendMessageAsync($"Hey <@{args.User.Id}>, {msg.Member.DisplayName ?? msg.Member.Name}'s system has disabled reaction pings. You can mention them by copy pasting the following message:");
|
||||
await args.Channel.SendMessageAsync($"`<@{msg.Message.Sender}>`");
|
||||
if (!msg.System.PingsEnabled) {
|
||||
// If the target system has disabled pings, tell the pinger and bail
|
||||
var member = await args.Guild.GetMemberAsync(args.User.Id);
|
||||
try
|
||||
{
|
||||
await member.SendMessageAsync($"{Emojis.Error} {msg.Member.DisplayName ?? msg.Member.Name}'s system has disabled reaction pings. If you want to mention them anyway, you can copy/paste the following message:");
|
||||
await member.SendMessageAsync($"`<@{msg.Message.Sender}>`");
|
||||
}
|
||||
catch (UnauthorizedException) { }
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
-- SCHEMA VERSION 6: 2020-03-21
|
||||
alter table systems add column pings bool not null default true;
|
||||
alter table systems add column pings_enabled bool not null default true;
|
||||
update info set schema_version = 6;
|
@ -17,7 +17,7 @@ namespace PluralKit.Core {
|
||||
[JsonIgnore] public string Token { get; set; }
|
||||
[JsonProperty("created")] public Instant Created { get; set; }
|
||||
[JsonProperty("tz")] public string UiTz { get; set; }
|
||||
[JsonProperty("ping")] public bool Pings { get; set; }
|
||||
[JsonProperty("ping")] public bool PingsEnabled { get; set; }
|
||||
public PrivacyLevel DescriptionPrivacy { get; set; }
|
||||
public PrivacyLevel MemberListPrivacy { get; set; }
|
||||
public PrivacyLevel FrontPrivacy { get; set; }
|
||||
|
@ -118,7 +118,7 @@ namespace PluralKit.Core {
|
||||
|
||||
public async Task SaveSystem(PKSystem system) {
|
||||
using (var conn = await _conn.Obtain())
|
||||
await conn.ExecuteAsync("update systems set name = @Name, description = @Description, tag = @Tag, avatar_url = @AvatarUrl, token = @Token, ui_tz = @UiTz, description_privacy = @DescriptionPrivacy, member_list_privacy = @MemberListPrivacy, front_privacy = @FrontPrivacy, front_history_privacy = @FrontHistoryPrivacy, pings = @Pings where id = @Id", system);
|
||||
await conn.ExecuteAsync("update systems set name = @Name, description = @Description, tag = @Tag, avatar_url = @AvatarUrl, token = @Token, ui_tz = @UiTz, description_privacy = @DescriptionPrivacy, member_list_privacy = @MemberListPrivacy, front_privacy = @FrontPrivacy, front_history_privacy = @FrontHistoryPrivacy, pings_enabled = @PingsEnabled where id = @Id", system);
|
||||
|
||||
_logger.Information("Updated system {@System}", system);
|
||||
await _cache.InvalidateSystem(system);
|
||||
|
Loading…
Reference in New Issue
Block a user