示例#1
0
def main():
    with open("Configs/VkKey.txt", "r") as file:
        vk_key = file.readline()

    with open("Configs/WeatherKey.txt", "r") as file:
        weather_key = file.readline()

    bot = Bot(vk_key, weather_key)
    bot.connect()
    bot.start_listening_for_messages()
示例#2
0
文件: main.py 项目: tursunova/irc_bot
from Bot import Bot

if __name__ == '__main__':

    options = {
        'server': 'chat.freenode.net',
        'port': 6667,
        'channel': '#2448',
        'nickname': 'FactsBot',
        'log_file': 'log.txt'
    }

    bot = Bot(**options)
    bot.connect()
    bot.listen()
示例#3
0
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
    print('------')