def main(): bot = MyBot(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, bot_jid=BOT_JID, verification_token=VERIFICATION_TOKEN) bot.run()
def setup(bot: MyBot): c = MiscCommands(bot) bot.add_cog(c)
def setup(bot: MyBot): cog = CuteCommands(bot) bot.add_cog(cog)
def setup(bot: MyBot): cog = WaifuCommands(bot) bot.add_cog(cog)
def setup(bot: MyBot): c = AdminOnly(bot) bot.add_cog(c)
def setup(bot: MyBot): c = OwnerOnly(bot) bot.add_cog(c)
from my_bot import MyBot import os bot = MyBot(command_prefix='?', description="Best bot.") TOKEN = os.getenv('WAIFU_BOT_TOKEN') bot.run(TOKEN)
def setup(bot: MyBot): c = NSFWOnly(bot) bot.add_cog(c)
if __name__ == '__main__': if len(sys.argv) != 2: print 'Usage: python simulator.py <option>' print '<option> can be 1 => Random player vs. Random player' print ' 2 => Human vs. Random Player' print ' 3 => Human vs. Human' sys.exit(1) obj1 = '' obj2 = '' option = sys.argv[1] if option == '1': obj1 = MyBot(22) obj2 = OPPONENT1 elif option == '2': obj1 = OPPONENT obj2 = Player7(23) elif option == '3': obj1 = Manual_Player() obj2 = Manual_Player() elif option == '4': obj2 = OPPONENT1 obj1 = OPPONENT else: print 'Invalid option' sys.exit(1) x = gameplay(obj1, obj2)
import os import sys from dotenv import load_dotenv from my_bot import MyBot def prompt_user(my_bot): message = raw_input("Enter your message: ") if message == 'quit': pass else: reply = my_bot.process_message(message) print reply prompt_user(my_bot) if __name__ == '__main__': load_dotenv(os.path.join(os.path.dirname(__file__), '.env')) my_bot = MyBot(os.environ.get('CONVERSATION_USERNAME'), os.environ.get('CONVERSATION_PASSWORD'), os.environ.get('CONVERSATION_WORKSPACE_ID')) prompt_user(my_bot)
# Send a message to the user await context.send_activity("Oops. Something went wrong!") # Clear out state await CONVERSATION_STATE.delete(context) ADAPTER.on_turn_error = on_error # Create MemoryStorage, UserState and ConversationState MEMORY = MemoryStorage() # Commented out user_state because it's not being used. USER_STATE = UserState(MEMORY) CONVERSATION_STATE = ConversationState(MEMORY) BOT = MyBot(CONVERSATION_STATE, USER_STATE) @APP.route("/api/messages", methods=["POST"]) def messages(): """Main bot message handler.""" if request.headers["Content-Type"] == "application/json": body = request.json else: return Response(status=415) activity = Activity().deserialize(body) auth_header = ( request.headers["Authorization"] if "Authorization" in request.headers else "" )