Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STILL A DRAFT (BLACKLIST) #97

Draft
wants to merge 3 commits into
base: rewrite
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cogs/BotAdmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,11 @@ async def ban(self, ctx, *, members = None, reason = None):

eg: $ban @user1#1234 @user2#5678 @user3#9012 for spamming"""
await self.kick_ban(ctx,members, "ban")

@commands.command(pass_context=True)
async def blacklist(self, ctx, userid, reason = None):
"""Bans a target who is NOT currently on the server via userid
This can only blacklist one member at a time.
All blacklists are stored in a | seperated list in a file where the bot is stored
"""
await self.settings.BlacklistUser(userid)
13 changes: 10 additions & 3 deletions Cogs/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ def __init__(self, bot, prefix = "$", file : str = None):
"Hunger" : 0, # The bot's hunger % 0-100 (can also go negative)
"HungerLock" : False, # Will the bot stop answering at 100% hunger?
"SuppressMentions" : True, # Will the bot suppress @here and @everyone in its own output?
"Volume" : "", # Float volume for music player
"Volume" : "", # Float volume for music player
"BlacklistedUsers" : [], # List of blacklisted users in a server
"DefaultVolume" : 0.6, # Default volume for music player
"Playlisting" : None, # Not adding a playlist
"PlaylistRequestor" : None, # No one requested a playlist
Expand Down Expand Up @@ -739,6 +740,13 @@ def removeUserID(self, id, server):
self.serverDict["Servers"][str(server.id)]["Members"].pop(str(id), None)
self.checkGlobalUsers()

def BlacklistUser(self, server, userid):
self.checkServer(server)
self.serverDict["Servers"][str(server.id)]["BlacklistedUsers"].append(userid)
self.checkServer(server)

def GetBlacklistedUsers(self, server):
return self.serverDict["Servers"][str(server.id)]["BlacklistedUsers"]

# Return the requested stat
def getUserStat(self, user, server, stat, default = None):
Expand Down Expand Up @@ -787,8 +795,7 @@ def incrementStat(self, user, server, stat, incrementAmount):
value = self.serverDict["Servers"].get(str(server.id),{}).get("Members",{}).get(str(user.id),{}).get(stat,0)
self.serverDict["Servers"][str(server.id)]["Members"][str(user.id)][stat] = value+incrementAmount
return value+incrementAmount



# Get the requested stat
def getServerStat(self, server, stat, default = None):
# Make sure our server exists in the list
Expand Down