示例#1
0
def initBot():
    global bot
    bot = Bot()
示例#2
0
from Bot import Bot
from CommandHandler import CommandHandler

bot = Bot("350263518:AAHTcAESb1VKuAT3cgiks0PMNPSinWlAs2I")

handler = CommandHandler(bot.bot)
handler.start_handle()
示例#3
0
from flask import Flask, render_template, request
from Bot import Bot

bot = Bot()
app = Flask(__name__)


@app.route("/")
def home():
    return render_template("index.html")


@app.route("/process")
def process():
    user_inpt = request.args.get('msg')
    bot_response = bot.respond(user_inpt)
    return str(bot_response)


@app.route("/vote")
def vote():
    user_vote = request.args.get('relevance')
    bot.dataManager.vote(user_vote)


if __name__ == "__main__":
    app.run()
        self.title(self.image_name)
        # self.center()
        self.after(self.slide_interval, self.show_new_images)

    def start(self):
        """Start method"""
        self.after(self.slide_interval, self.show_new_images)
        self.mainloop()

    def get_images_from_disk(self):
        exts = ["jpg", "bmp", "png", "gif", "jpeg"]
        images = [
            fn for fn in os.listdir(path) if any(
                fn.endswith(ext) for ext in exts)
        ]
        images.sort()
        if len(images) > len(self.images):
            self.images = images
            self.next_image_index = len(self.images) - 1


if __name__ == "__main__":
    slide_interval = 2500

    bot = Bot(bot_token, bot_image_path)
    bot.updatePictures()

    # start the slideshow
    slideshow = Slideshow(slide_interval, bot)
    slideshow.start()
示例#5
0
from flask import Flask, jsonify, request
import re
import random
from Bot import Bot

app = Flask(__name__)
app.config["DEBUG"] = True
myBot = Bot() #instance of bot class from Bot.py file

@app.after_request
def after_request(response):
  response.headers.add('Access-Control-Allow-Origin', '*')
  response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
  response.headers.add('Access-Control-Allow-Methods', 'GET,POST,OPTIONS')
  return response

@app.route('/fortune', methods=['GET'])
def fortune():
    return jsonify({
        'data':'How many of you believe?',
        'status' : 'awesome'
    }), 200

@app.route('/hello', methods=['GET'])
def routeHere():
    myBot.check()
    print(request.args.get('question', default='*', type=str))
    return jsonify('Hello, how are doing today? Is there anything I can help with? '), 200

@app.route('/convo', methods=['GET'])
def convoRoute():
示例#6
0
from Bot import Bot

botnet = []

mybot1 = Bot('127.0.0.1', 'test', 'test1234')
mybot2 = Bot('127.0.0.2', 'test', 'test1234')
mybot3 = Bot('127.0.0.3', 'test', 'test1234')

botnet.append(mybot1)
botnet.append(mybot2)
botnet.append(mybot3)


# envoyer une commande a teoute les machines
def command_bots(command):
    for bot in botnet:
        attack = bot.send_command(command)
        print('Output from ' + bot.host)
        print(attack)


command_bots("ls")
示例#7
0
 def setUp(self):
     self.humanPlayer = HumanPlayer().randomName()
     self.botPlayer = Bot()
     self.engine = TestGoFishEngine(True)
示例#8
0
# start_bot.py
import os
from dotenv import load_dotenv

from Bot import Bot
from MyLogging import init_logger

init_logger()

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')

client = Bot(TOKEN, GUILD)
示例#9
0
import logging
from os import environ as en
from threading import Thread
from time import sleep

from Bot import Bot
from discord.game import Game
from TwitchAPI import check_for_stream

# Set up the logging module to output diagnostic to the console.
logging.basicConfig()

#bot created as a Bot object , taking an email address, a password
#and an optionnal whitelist of people allowed to use certain commands.
botwyniel = Bot(en["EMAIL"], en["PASSWORD"], wl=["Etwyniel", "Jhysodif"])
#bot attempts to connect, exits in case of failure
botwyniel.connect(0)

if not botwyniel.is_logged_in:
    print("Logging in to Discord failed")
    exit(1)

def list_servers():
    print("\nAvailable servers:")
    for a in botwyniel.servers:
        print(a.name)
        botwyniel.servs[a.name] = a
        ch_dict = {}
        for channel in a.channels:
            ch_dict[channel.name] = channel
        botwyniel.channels[a] = ch_dict
示例#10
0
#Bots
from SubmitHubBot import SubmitHubBot
from InstagramBot import InstagramBot
from TwitterBot import TwitterBot
from Bot import Bot

#Database module
from Database import Database

#Credentials
from config import credentials

#Params
from config import params

logBot = Bot(logBot=True)


#Run with param --curses to use curses interface
def interface(stdscr, running_bots, finished_bots, threads):  #stdscr,
    time.sleep(1)

    #Use colors
    curses.start_color()
    curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
    curses.init_pair(2, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
    curses.init_pair(4, curses.COLOR_YELLOW, curses.COLOR_BLACK)
    stdscr.bkgd(' ', curses.color_pair(1) | curses.A_BOLD)

    #Set cursor invisible
示例#11
0
from Bot import Bot
bot = Bot('178.170.117.29', 'creditentials.json')

bot.browse_hashtag("memes")
示例#12
0
文件: main.py 项目: JordanDG/com404
from Bot import Bot
from SuperBot import SuperBot
from FlyingBot import FlyingBot

test = Bot("Botty")

test.get_age()
test.get_energy()
test.get_name()
test.get_shield()

test.decrement_energy()
test.decrement_shield()

test.display_name()
test.display_age()
test.display_energy()
test.display_shield_level()
test.display_summary()
print(test.__str__())

test.increment_age()
test.increment_energy()
test.increment_shield()

test.set_name()

super_bot = SuperBot("John")

super_bot.get_super_power_level(3000)
super_bot.set_super_power_level(3000)
示例#13
0
文件: main.py 项目: Mr0l3/JarvisBot
def main():
    bot = Bot()
    bot.startBot()
示例#14
0
from Bot import Bot, UpdateHandler


def message_handler(bot, update):

    msg_reply = {"hi": "hello", "how are you?": "I am good"}

    username = update['message']['from']['username']
    text = update['message']['text']
    chat_id = update['message']['chat']['id']

    print(f'New message from {username}: {text}')

    reply = msg_reply.get(text.lower(), "I don't know what to say!")
    bot.send_message(chat_id=chat_id, text=reply)


def update_handler(bot, update):

    if 'message' in update:
        message_handler(bot, update)


bot = Bot(token="1173786457:AAF_1DO1vdhq9RiQp5hh3NnsVmLcTtsCjRo")
updater = UpdateHandler(bot, timeout=3)
updater.register(update_handler)
updater.start_polling()
示例#15
0
    def test_if_player_class(self):
        self.player_1 = HumanPlayer
        self.player_2 = Bot()

        self.assertTrue(isinstance(self.player_2, self.player_1))
示例#16
0
 def load_bots(self):
     self.bot_map.clear()
     db = Scenario_DB()
     for scenario_key, scenario in db.get_scenarios():
         self.bot_map[scenario_key] = (Bot(scenario, 1e-8), scenario)
示例#17
0
 def test_two_diff_same_name_not_equal(self):
     self.player_1 = Bot("Jeffery")
     self.player_2 = Bot("Jeffery")
     self.assertNotEqual(self.player_1, self.player_2)
示例#18
0
    bot.go_to_goal('outside lift')
    say('Please follow me')
    lift.close_door()
    guide(name, destination['venue'])
    speech.order_drink()
    speech.common_talk()
    bot_state = 'idle'


if __name__ == '__main__':
    # facial_recog = FacialRecog()
    # facial_recog.train('Michael', cv2.imread('michael2.jpg'))
    # bot_state = 'guest'
    # faces = {}
    # eyes()
    bot = Bot('192.168.43.11', 7171, 'adept')
    kiosk = Kiosk()
    lift = Lift()
    speech = Speech()
    facial_recog = FacialRecog()
    bot_state = 'idle'
    faces = {}
    guest_info = {
        'name': 'name',
        'venue': 'venue',
        'face': cv2.imread('xinran.jpg')
    }

    t_eyes = threading.Thread(target=eyes, args=())
    t_main = threading.Thread(target=main, args=())
    t_kiosk = threading.Thread(target=get_kiosk, args=())
示例#19
0
from Bot import Bot

# your location to chromedriver executable
bot = Bot('/Users/**/Downloads/chromedriver')

bot.goto_youtube() \
    .login(email='your@email', password='******') \
    .subscribe(channelId='uisdg22g') \
    .end()
示例#20
0
 def __init__(self):
     self.data_training = "testData.json"
     self.Bot = Bot()
     self.training_nlu()