mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-01 19:49:55 +03:00
every single file changed lulw
This commit is contained in:
parent
f30485dd71
commit
4d838e5af3
14 changed files with 825 additions and 511 deletions
|
@ -14,14 +14,21 @@ public class UnmuteCommand : Command {
|
|||
await CommandHandler.CheckPermissions(author, GuildPermission.ManageMessages, GuildPermission.ManageRoles);
|
||||
await CommandHandler.CheckInteractions(author, toUnmute);
|
||||
var role = Utils.GetMuteRole(context.Guild);
|
||||
if (role != null)
|
||||
if (role != null) {
|
||||
if (toUnmute.RoleIds.All(x => x != role.Id)) {
|
||||
var rolesRemoved = Boyfriend.GetGuildConfig(context.Guild).RolesRemovedOnMute;
|
||||
var config = Boyfriend.GetGuildConfig(context.Guild);
|
||||
var rolesRemoved = config.RolesRemovedOnMute;
|
||||
|
||||
foreach (var roleId in rolesRemoved[toUnmute.Id]) await toUnmute.AddRoleAsync(roleId);
|
||||
foreach (var roleId in rolesRemoved![toUnmute.Id]) await toUnmute.AddRoleAsync(roleId);
|
||||
rolesRemoved.Remove(toUnmute.Id);
|
||||
await config.Save();
|
||||
throw new ApplicationException(Messages.RolesReturned);
|
||||
}
|
||||
}
|
||||
if (role != null && toUnmute.RoleIds.All(x => x != role.Id) ||
|
||||
toUnmute.TimedOutUntil == null || toUnmute.TimedOutUntil.Value.ToUnixTimeMilliseconds()
|
||||
< DateTimeOffset.Now.ToUnixTimeMilliseconds())
|
||||
throw new ApplicationException(Messages.MemberNotMuted);
|
||||
|
||||
UnmuteMember(context.Guild, context.Channel as ITextChannel, context.Guild.GetUser(context.User.Id),
|
||||
toUnmute, Utils.JoinString(args, 1));
|
||||
|
@ -33,12 +40,19 @@ public class UnmuteCommand : Command {
|
|||
var authorMention = author.Mention;
|
||||
var notification = string.Format(Messages.MemberUnmuted, authorMention, toUnmute.Mention,
|
||||
Utils.WrapInline(reason));
|
||||
await toUnmute.RemoveRoleAsync(Utils.GetMuteRole(guild));
|
||||
var config = Boyfriend.GetGuildConfig(guild);
|
||||
var role = Utils.GetMuteRole(guild);
|
||||
|
||||
if (config.RolesRemovedOnMute.ContainsKey(toUnmute.Id)) {
|
||||
foreach (var roleId in config.RolesRemovedOnMute[toUnmute.Id]) await toUnmute.AddRoleAsync(roleId);
|
||||
config.RolesRemovedOnMute.Remove(toUnmute.Id);
|
||||
if (role != null) {
|
||||
await toUnmute.RemoveRoleAsync(role);
|
||||
var config = Boyfriend.GetGuildConfig(guild);
|
||||
|
||||
if (config.RolesRemovedOnMute!.ContainsKey(toUnmute.Id)) {
|
||||
foreach (var roleId in config.RolesRemovedOnMute[toUnmute.Id]) await toUnmute.AddRoleAsync(roleId);
|
||||
config.RolesRemovedOnMute.Remove(toUnmute.Id);
|
||||
await config.Save();
|
||||
}
|
||||
} else {
|
||||
await toUnmute.RemoveTimeOutAsync();
|
||||
}
|
||||
|
||||
await Utils.SilentSendAsync(channel, string.Format(Messages.UnmuteResponse, toUnmute.Mention,
|
||||
|
@ -58,4 +72,4 @@ public class UnmuteCommand : Command {
|
|||
public override string GetSummary() {
|
||||
return "Снимает мут с участника";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue