コード例 #1
0
def main():
    bot = MyBot(client_id=CLIENT_ID,
                client_secret=CLIENT_SECRET,
                bot_jid=BOT_JID,
                verification_token=VERIFICATION_TOKEN)

    bot.run()
コード例 #2
0
def setup(bot: MyBot):
    c = MiscCommands(bot)
    bot.add_cog(c)
コード例 #3
0
def setup(bot: MyBot):
    cog = CuteCommands(bot)
    bot.add_cog(cog)
コード例 #4
0
def setup(bot: MyBot):
    cog = WaifuCommands(bot)
    bot.add_cog(cog)
コード例 #5
0
def setup(bot: MyBot):
    c = AdminOnly(bot)
    bot.add_cog(c)
コード例 #6
0
def setup(bot: MyBot):
    c = OwnerOnly(bot)
    bot.add_cog(c)
コード例 #7
0
from my_bot import MyBot

import os

bot = MyBot(command_prefix='?', description="Best bot.")

TOKEN = os.getenv('WAIFU_BOT_TOKEN')
bot.run(TOKEN)
コード例 #8
0
def setup(bot: MyBot):
    c = NSFWOnly(bot)
    bot.add_cog(c)
コード例 #9
0

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)
コード例 #10
0
ファイル: app.py プロジェクト: Hisenburger/thecoolchad-repo
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)
コード例 #11
0
ファイル: app.py プロジェクト: huanmai-kms/pythonchatbot
    # 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 ""
    )