Skip to content

Commit

Permalink
Fix rookie mistake 🚑 👽
Browse files Browse the repository at this point in the history
Release stable: 1.1.0 with the new ``-o / --output`` argument

and fix if statement from ``fourtytwo == "foo" or "bar"`` to ``fourtytwo == "meaning of life" or fourtytwo == "42"`` 👽 🐍

Also update readme

Thx mrx for help 👍

Co-Authored-By: mrx <[email protected]>
  • Loading branch information
core-hacked and mrx-rx committed Dec 20, 2021
1 parent 7291410 commit c7a4c2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ To get a local copy up and running follow these simple steps.
# -p or --prefix [prefix] | Specify a prefix (for double word prefix' or ones with special char's use quotes)
# -b or --heartbeat [int] | Specify the heartbeat timeout
# -s or --serverpurge [prefix] | Specify a prefix for a server purge or leave blank for default
# (W.I.P) -n or --nooutput [bool (True/False)] | Specify if you want console output of each deleted message (true by default)
# -o or --output | Specify if you want to output deleted messages in the console
# -h or --help | to view this in the terminal/console
```
Then in discord type your prefix or the default ``#DEL`` or ``#PS`` to purge messages from an entire server
Expand Down
39 changes: 12 additions & 27 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,45 +44,35 @@ async def on_message(self, message):
parser.add_argument('-p','--prefix', dest='prefix', type=str, help='Prefix to use with message purger')
parser.add_argument('-s','--serverpurge', dest='serverpurge', type=str, help='Specify a prefix to use for Server Purge')
parser.add_argument('-b','--heartbeat', dest='heartbeat', type=int, help='Heartbeat timeout to use')
parser.add_argument('-n','--nooutput', dest='nooutput', type=str, help='Enable console output of deleted messages (Good for debugging)')
parser.add_argument('-o', '--output', action='store_true', help='Enable console output of deleted messages (Good for debugging)')
args = parser.parse_args()

# Token
if args.token is not None:
token = args.token

# Prefix

if args.prefix is not None:
prefix = args.prefix
else:
prefix = "#DEL"

# Serverpurge prefix

if args.serverpurge is not None:
serverpurge = args.serverpurge
else:
serverpurge = "PS"

# Hearbeat

if args.heartbeat is not None:
heartbeat = args.heartbeat
else:
heartbeat = 86400

# No console output / log
# output
if args.output == True:
nooutput = False

if args.nooutput is not None:
if args.nooutput == "f" or "F" or "false" or "False" or "FALSE" or "n" or "N" or "No" or "NO":
nooutput = bool(False)
elif args.nooutput == "t" or "T" or "true" or "True" or "TRUE" or "y" or "Y" or "Yes" or "YES":
nooutput = bool(True)
else:
nooutput = bool(True)
else:
nooutput = True
else:
token = input("Please input a Token: ")
# Prefix
Expand All @@ -106,20 +96,15 @@ async def on_message(self, message):
heartbeat = input("Please input a heartbeat timeout (leave blank for the default 86400): ")
if heartbeat == "":
heartbeat = 86400
# No console output / log
if args.nooutput is not None:
if args.nooutput == "f" or "F" or "false" or "False" or "FALSE" or "n" or "N" or "No" or "NO":
nooutput = bool(False)
elif args.nooutput == "t" or "T" or "true" or "True" or "TRUE" or "y" or "Y" or "Yes" or "YES":
nooutput = bool(True)
else:
nooutput = bool(True)
# output
if args.output == True:
nooutput = False
else:
nooutputstr = input("Do you want to log deleted messages to console (Y/N): ")
if nooutputstr == "n" or "N" or "No" or "NO":
nooutput = bool(True)
elif nooutputstr == "y" or "Y" or "Yes" or "YES":
nooutput = bool(False)
nop = input("Do you want to log console output? (Y/N): ")
if nop == "" or nop == "n" or nop == "N" or nop == "No" or nop == "NO":
nooutput = True
elif nop == "y" or nop == "Y" or nop == "Yes" or nop == "YES":
nooutput = False


# Run the self-bot and await prefix
Expand Down

0 comments on commit c7a4c2a

Please sign in to comment.