Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Commit

Permalink
Self-warn
Browse files Browse the repository at this point in the history
Admins can't use commands on themselves
  • Loading branch information
fajnyCreeper committed Sep 28, 2017
1 parent 2b5254d commit c089cf2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/WarnBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private async Task MessageReceived(SocketMessage msg)
case "/warn":
try
{
if (DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[0] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id)
if ((DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[0] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id) && ulong.Parse(usr2ulong) != msg.Author.Id)
{
DBConnector.Prepare(user, chnl.Guild.Id);
int count = DBConnector.WarnCount(user, chnl.Guild.Id) + 1;
Expand Down Expand Up @@ -89,7 +89,7 @@ private async Task MessageReceived(SocketMessage msg)
case "/kick":
try
{
if (DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[0] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id)
if ((DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[0] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id) && ulong.Parse(usr2ulong) != msg.Author.Id)
{
DBConnector.Prepare(user, chnl.Guild.Id);
int[] info = DBConnector.Info(user, chnl.Guild.Id);
Expand Down Expand Up @@ -125,7 +125,7 @@ private async Task MessageReceived(SocketMessage msg)
case "/ban":
try
{
if (DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[1] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id)
if ((DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[1] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id) && ulong.Parse(usr2ulong) != msg.Author.Id)
{
if (context != "")
{
Expand Down Expand Up @@ -158,8 +158,8 @@ private async Task MessageReceived(SocketMessage msg)
break;
case "/clear":
try
{
if (DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[1] >= 1 || msg.Author.Id == chnl.Guild.Owner.Id)
{
if (DBConnector.PermCheck(msg.Author.Id, chnl.Guild.Id)[1] >= 1 || (msg.Author.Id == chnl.Guild.Owner.Id || ulong.Parse(usr2ulong) != msg.Author.Id))
{
DBConnector.Clear(user, chnl.Guild.Id);
await msg.Channel.SendMessageAsync("Cleared record for " + user);
Expand Down

0 comments on commit c089cf2

Please sign in to comment.