def initBot(): global bot bot = Bot()
from Bot import Bot from CommandHandler import CommandHandler bot = Bot("350263518:AAHTcAESb1VKuAT3cgiks0PMNPSinWlAs2I") handler = CommandHandler(bot.bot) handler.start_handle()
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()
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():
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")
def setUp(self): self.humanPlayer = HumanPlayer().randomName() self.botPlayer = Bot() self.engine = TestGoFishEngine(True)
# 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)
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
#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
from Bot import Bot bot = Bot('178.170.117.29', 'creditentials.json') bot.browse_hashtag("memes")
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)
def main(): bot = Bot() bot.startBot()
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()
def test_if_player_class(self): self.player_1 = HumanPlayer self.player_2 = Bot() self.assertTrue(isinstance(self.player_2, self.player_1))
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)
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)
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=())
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()
def __init__(self): self.data_training = "testData.json" self.Bot = Bot() self.training_nlu()