.crdm was deleted by accident, it's back now
This commit is contained in:
parent
f773b0c6b6
commit
e9cf57d46f
@ -320,6 +320,57 @@ namespace NadekoBot.Modules.CustomReactions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
public async Task CrDm(int id)
|
||||||
|
{
|
||||||
|
if ((Context.Guild == null && !_creds.IsOwner(Context.User)) ||
|
||||||
|
(Context.Guild != null && !((IGuildUser)Context.User).GuildPermissions.Administrator))
|
||||||
|
{
|
||||||
|
await ReplyErrorLocalized("insuff_perms").ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomReaction[] reactions = new CustomReaction[0];
|
||||||
|
|
||||||
|
if (Context.Guild == null)
|
||||||
|
reactions = _service.GlobalReactions;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_service.GuildReactions.TryGetValue(Context.Guild.Id, out reactions);
|
||||||
|
}
|
||||||
|
if (reactions.Any())
|
||||||
|
{
|
||||||
|
var reaction = reactions.FirstOrDefault(x => x.Id == id);
|
||||||
|
|
||||||
|
if (reaction == null)
|
||||||
|
{
|
||||||
|
await ReplyErrorLocalized("no_found_id").ConfigureAwait(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var setValue = reaction.DmResponse = !reaction.DmResponse;
|
||||||
|
|
||||||
|
using (var uow = _db.UnitOfWork)
|
||||||
|
{
|
||||||
|
uow.CustomReactions.Get(id).DmResponse = setValue;
|
||||||
|
uow.Complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setValue)
|
||||||
|
{
|
||||||
|
await ReplyConfirmLocalized("crdm_enabled", Format.Code(reaction.Id.ToString())).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await ReplyConfirmLocalized("crdm_disabled", Format.Code(reaction.Id.ToString())).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await ReplyErrorLocalized("no_found").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
public async Task CrAd(int id)
|
public async Task CrAd(int id)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user