def main(): for extension in startup: try: bot.load_extension(extension) except Exception as e: bot.dev_logger.warning(f"Failed to load extension {extension}\n" f"{type(e).__name__}: {e}") bot.run(bot.config.discord_key)
def main(): # Telegram token env_path = Path('.') / '.env' load_dotenv(dotenv_path=env_path) telegram_token = os.getenv('TELEGRAM_TOKEN') if telegram_token is None: logging.error('Telegram token not found') exit() bot.run(telegram_token)
from bot import bot from config import config bot.run(config['DISCORD_TOKEN'])
from discord.ext import commands from bot.bot import run cogs = [ "utility.general", "utility.charinfo", "core.status", "core.misc", "core.config", "fun.catpics", "fun.dogpics", "fun.cables", "fun.stickbug" ] cogs = ["bot.cogs." + cog for cog in cogs] cogs.append("jishaku") run(cogs, help_command=commands.MinimalHelpCommand())
import json from modules import * from bot import bot, database if __name__ == "__main__": json_data = open("parameters.json") parameters = json.load(json_data) database.initialize_db() bot.run(parameters["token"])
from bot.bot import run run(["jishaku", "bot.cogs.utility.general", "bot.cogs.core.dis"], debug=False)
from bot import bot import keep_alive as alive VERSION = '0.0.4' # Keep the server alive 24/7 alive.keep_alive() bot.run(version=VERSION)
from bot.bot import run run([ "bot.cogs.utility.general", "bot.cogs.utility.status", "bot.cogs.utility.links", "bot.cogs.utility.nickrequest", "bot.cogs.utility.emoji", "bot.cogs.utility.antimassping", "bot.cogs.utility.autopin", "bot.cogs.fun.fun", "bot.cogs.ext.cog", "jishaku" ], False)
"""Create a ctx from a channel message placeholder""" channel = bot.get_channel(channel) message = await channel.fetch_message(id=message_id) return await bot.get_context(message) async def _schedule(ctx): """Get schedule for daily task.""" await getclass(ctx, args="now", is_scheduler=True) LOGGER.info("Daily task complete") async def daily_task(): """Create a daily task.""" while True: now = datetime.utcnow() date = now.date() if now.time() > DT_TIME: date = now.date() + timedelta(days=1) then = datetime.combine(date, DT_TIME) await discord.utils.sleep_until(then) LOGGER.info("Running daily schedule task") ctx = await _create_context(SCHEDULE_CHANNEL, TASK_MSG_PLACEHOLDER) await _schedule(ctx) if __name__ == "__main__": LOGGER.info("Modules Loaded: %s", str(ALL_MODULES)) bot.loop.create_task(startup()) bot.run(BOT_TOKEN)
from bot import bot, bot_token bot.run(bot_token)
def start_server(): discord_client.run(config.DISCORD_TOKEN)
from bot.bot import run run([ "jishaku", "bot.cogs.core.general" ], debug=False)
import os from bot import bot from bot.datastore.database import init_db init_db() bot.run(os.environ.get("BOT_PASSWORD"))
#!/usr/bin/python3 from bot import bot from config import settings bot.run(settings['token'])
from bot.bot import run run([ "bot.cogs.utility.general" ], True)
import sys from bot.cfg import configurator # Load config if one is given if len(sys.argv) > 1: configurator.loadCfg(sys.argv[1]) # initialize bot config configurator.init() # load and run bot from bot import bot status = bot.run() # return exit status code for bot restarting print("returning status code " + str(status)) sys.exit(status)
import os import config from bot import bot if not os.path.exists(config.database_name): from helpers import db db.initialize_db() bot.run(config.token)
import os import commands import events import dotenv from bot import bot dotenv.load_dotenv() token = os.getenv("BOT_TOKEN") bot.run(token)
def main(): bot.dispatcher.add_handler(CommandHandler('start', start)) bot.run()
from bot.bot import run run(["jishaku", "bot.cogs.utility.general", "bot.cogs.utility.database"], debug=False)
from os import environ from dotenv import load_dotenv, find_dotenv from bot import bot load_dotenv(find_dotenv()) if __name__ == "__main__": bot.run(environ.get("DISCORD_TOKEN"))
from bot.bot import run run([ "bot.cogs.utility.general", "bot.cogs.utility.status", "bot.cogs.utility.links", "bot.cogs.utility.nickrequest", "bot.cogs.utility.emoji", "bot.cogs.utility.antimassping", "bot.cogs.utility.autopin", "bot.cogs.utility.server", "bot.cogs.utility.tos", "bot.cogs.utility.newalert", #"bot.cogs.utility.langwarn", "bot.cogs.utility.automod", "bot.cogs.utility.rankup", "bot.cogs.fun.fun", "bot.cogs.fun.stonks", "bot.cogs.fun.lmgtfy", "bot.cogs.ext.cog", "bot.cogs.fun.imdec", "bot.cogs.minecraft.seedfinder", "jishaku" ], False)
from bot.bot import run run( [ "bot.cogs.utility.general", "bot.cogs.utility.administration", "bot.cogs.utility.faq", "bot.cogs.moderation.mute", "bot.cogs.moderation.content", "bot.cogs.moderation.members", "bot.cogs.moderation.punish", "bot.cogs.moderation.reactions", "bot.cogs.stats.messages", #"bot.cogs.stats.presence", "jishaku" ], False)
# Import des libs from dotenv import load_dotenv from os import getenv from bot import bot from web import app # On load l'environement load_dotenv() # On démarre le serveur web bot.loop.create_task(app.run_task('0.0.0.0', 5000)) # On connecte le bot au serveur bot.run(getenv('TOKEN'))
import asyncio import datetime import os, sys from bot import bot loop = asyncio.get_event_loop() bot = bot(loop=loop, max_messages=10000) if __name__ == "__main__": try: task = loop.create_task(bot.run()) bot.own_task = task loop.run_until_complete(task) loop.run_forever() except (KeyboardInterrupt, RuntimeError): print('\nKeyboardInterrupt - Shutting down...') bot.die() finally: print('--Closing Loop--') loop.close()
def main(): bot.run(DISCORD_TOKEN)
parser = ArgumentParser(description='Starts ASB') parser.add_argument('--token_type', '-t', type=str, default='TEST', help='api token name (from config) for access to bot') parser.add_argument('--workers', '-w', type=int, default=10, help='number of workers for running bot') return parser.parse_args() if __name__ == '__main__': args = parse_argv() token_type = args.token_type.upper() token = TOKENS.get(token_type, TOKENS['TEST']) logger_level = LOGGING_LEVELS.get(token_type, logging.INFO) q = mq.MessageQueue(all_burst_limit=3, all_time_limit_ms=3000) mqbot = MQBot(token, mqueue=q) startup_params = { 'logger_level': logger_level, 'workers': args.workers, 'bot': mqbot } bot.run(**startup_params)
def main(): load_dotenv('.env') TOKEN = os.getenv('TOKEN') # keep_alive() bot.run(VERSION, TOKEN)
elif item.quality == 5: price = 1000 if show_price: await ctx.send("Selling this item will net you ", price, " gold.") else: character["Gold"] += price await remove_item(ctx, character_name, item_name) shared_functions.backup_characters() # Selling to NPC: Good roll: NPC will buy for close to full price if they have enough gold, and tell you 'I can't # afford that' otherwise. Bad roll: NPC will buy for low price close to store price. If NPC doesn't have enough # gold still, they will offer all their gold. @bot.event async def on_message(message): # Currently, if the bot is down, it will not check the channel history to see if it missed any inputs # while it was down. This is not too hard to do (save the message ID of the latest read message in the JSON, # then get history in this channel since that message and iterate through all missed messages on boot, # disregarding all but the first from each user). # If there is ever a need for message-by-message scanning, the wizard can be safely tucked into a function and left # in wizards.py, with the actual event moved to main. if message.channel.id == 714589518983987212 or message.channel.id == 714628821646835889: await wizard.wizard_main(message) await bot.process_commands(message) bot.run(TOKEN)
#!/usr/bin/env python3 # # Valentin Diard, 2019 # # Project: Sakura.py # License: MIT License # # File: run.py # Description: Launch the bot. # from bot import bot bot.run()
# -*- coding: utf-8 -*- import sys from bot import bot if __name__ == "__main__": if len(sys.argv) > 1 and sys.argv[1] == 'testing': from config import TestConfig bot.set_config(TestConfig()) elif len(sys.argv) > 1 and sys.argv[1] == 'ceci': from config import CeciConfig bot.set_config(CeciConfig()) elif len(sys.argv) > 1 and sys.argv[1] == 'freenode': from config import EntchenConfigFreenode bot.set_config(EntchenConfigFreenode()) else: from config import EntchenConfig bot.set_config(EntchenConfig()) bot.run()