Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def run_tests():
reddit = apraw.Reddit("D6B")
i = 0
for test in tests:
print("{}:".format(i), test)
i += 1
while True:
i = input("Select a test to run: ")
try:
i = int(i)
if i >= 0 and i < len(tests):
await tests[i](reddit)
else:
print("No test found at position {}!".format(i))
except Exception as e:
s = re.search("^(\d+)$", i)
if s is None:
import configparser
from datetime import datetime
import apraw
import banhammer
import discord
from banhammer import Banhammer
from banhammer.models import EventHandler, ItemAttribute, RedditItem, Subreddit
from discord.ext import commands
from discord.ext.commands import Bot
from config import config as bh_config
reddit = apraw.Reddit("TBHB")
class Banhacker(Bot, Banhammer):
def __init__(self, **options):
super().__init__(
bh_config["command_prefix"],
description="The Banhacker bot built for Discord's Hack-Week based on the Banhammer framework.",
**options)
Banhammer.__init__(self, reddit, bot=self, change_presence=bh_config["change_presence"])
@property
def embed(self):
embed = discord.Embed(colour=self.embed_color)
embed.set_footer(text=self.user.name, icon_url=self.user.avatar_url)
embed.timestamp = datetime.now()