def run_bot(): from config import TOKEN, bot def modify_allowed_mentions(): import discord nonlocal bot bot.allowed_mentions = discord.AllowedMentions(everyone=None, users=None, roles=None) modify_allowed_mentions() bot.run(TOKEN)
'cogs.tasker', 'cogs.attendance', 'cogs.howtall', 'cogs.control_panel', 'cogs.giveaway', 'cogs.swifty', 'cogs.butler', 'cogs.helpers', 'cogs.grenade', 'cogs.signup', 'cogs.cleanup', 'cogs.countdown', 'cogs.ping_abuse', 'cogs.whitelist', 'cogs.cooldown', 'cogs.voice_clear', 'cogs.whosfault', 'cogs.info', 'cogs.chance', 'cogs.unit_patch' ] if __name__ == '__main__': for extension in extensions: try: bot.load_extension(extension) except Exception as error: print('{} cannot be loaded. [{}]'.format(extension, error)) bot.loop.run_until_complete(create_db_pool()) bot.run(TOKEN)
def run_bot(): from config import TOKEN, bot bot.run(TOKEN)
top_str = f'{ctx.guild.name}\n' if len(top_str) > top_len: top_len = len(top_str) top_str += 'Top balance on server\n\n' for idx, (name, user_balance) in enumerate(top_users_bal.items(), start=1): top_str += f'{idx}. {name.ljust(max_len_name_bal)} - balance: {user_balance.rjust(max_len_balance)}\n' top_str += "\nTop level on server\n\n" for idx, (name, user_level) in enumerate(top_users_level.items(), start=1): top_str += f'{idx}. {name.ljust(max_len_name_level)} - level: {user_level.rjust(max_len_level)}\n' img = Image.new('RGBA', (top_len*35, 805), color=(255, 0, 0, 0)) fnt = ImageFont.truetype('assets/consolab.ttf', 60) d = ImageDraw.Draw(img) d.text((10, 10), top_str, font=fnt, fill=(235, 89, 61)) img.save('top.png') await ctx.send(file=discord.File('top.png')) bot.load_extension('cogs.settings') bot.load_extension('cogs.blackjack') bot.load_extension('cogs.coinflip') bot.load_extension('cogs.versus') bot.load_extension('cogs.user') bot.run(token)
if ctx.author.name.lower() == os.environ[f"{env_prefix}BOT_NICK"].lower(): return # respond to a variety of hello, hey, hi, sup, etc. hellos = ['allo', 'hello', 'helloo', 'henlo', 'hey', 'heyhey', 'hai', 'hi', 'hii', 'hiii', 'hiiii', 'hiiiii', 'sup', 'sah', 'whatsup', 'ello', 'hawwo', 'hewo', 'howdy', 'yo', 'yoyo', 'yoyoyo', 'yoo', 'yooo', 'yoooo', 'yooooo', 'yoooooo', 'wuddup', 'wuddupwuddup', 'wuddupwuddupwuddupa', 'whatup', 'whatupwhatup', 'suspec19bff', 'suspec19bffsuspec19bff', 'suspec19bffsuspec19bffsuspec19bff', 'oi', 'oi oi'] # remove special characters and convert to lower case to compare to list message = ''.join(filter(str.isalnum, ctx.content.lower())) # print(message) if message in hellos: await ctx.channel.send(f"Hello @{ctx.author.name}! Welcome to the stream!") # Parrotings # if someone sends __ parrot back __ if ctx.content == '^': await ctx.channel.send('^') # TODO add a cooldown so bot only adds one f to a particular fs-in-chat event if ctx.content.lower() == 'f': await ctx.channel.send('f') # process the command await bot.handle_commands(ctx) if __name__ == "__main__": bot.run()
# Note: If you host the bot on Heroku (https://heroku.com/), you # need to assign the constants to a Config Vars. import setup import events import commands from config import bot, D_TOKEN bot.run(D_TOKEN)