Ejemplo n.º 1
0
def main():

    logging.config.dictConfig(settings.LOGGING)
    log.info('Starting application')
    messages.initialize()
    log.debug('Retrieved i18n dictionaries')
    log.debug(messages.msg_map)
    log.info('i18n tables loaded. Available languages are [{}]'.format(', '.join(messages.msg_map.keys())))

    ironbot = Bot(**settings.BOT)

    for ext in ('cogs.basic', 'cogs.maple'):
        try:
            ironbot.load_extension(ext)
        except:
            log.exception('Failed to load extension')

    @ironbot.event
    @asyncio.coroutine
    def on_ready():

        log.info('Logged in as {} id={}'.format(ironbot.user.name, ironbot.user.id))

    @ironbot.event
    @asyncio.coroutine
    def on_error(event):
        log.error('An error occurred for event "{}"'.format(event))

    @ironbot.event
    @asyncio.coroutine
    def on_command_error(error: DiscordException, ctx: Context):
        k = (type(error), type(ctx.message.channel), ctx.command.name)
        if k in errors.handled:
            log.debug('Handled command error: {}'.format(error))
            yield from ctx.bot.send_message(ctx.message.channel, errors.get(*k))
        else:
            log.warn('Unhandled command error: {}'.format(error))

    ironbot.loop.create_task(utils.scheduler_tick(ironbot))
    ironbot.run(settings.DISCORD_TOKEN)
Ejemplo n.º 2
0
def scheduler_tick(ironbot: Bot):

    log.info('Global scheduler starting...')
    yield from ironbot.wait_until_ready()

    # heartbeat function
    schedule.every(2).minutes.do(touch, HEARTBEAT_FILE)

    log.info('Global scheduler started')

    log.info('Scheduled jobs are:')
    for job in schedule.jobs:
        log.info(' * {}: {}'.format(id(job), job))

    while not ironbot.is_closed:
        schedule.run_pending()
        yield from asyncio.sleep(SCHEDULER_FREQUENCY, loop=ironbot.loop)
Ejemplo n.º 3
0
Archivo: bot.py Proyecto: etihW/Sandbox
import discord
from discord.ext.commands import Bot

my_bot = Bot(command_prefix="!")


@my_bot.event
async def on_read():
    print("Client logged in")
@my_bot.command()
async def hello(*args):
    return await my_bot.say("Hello, world!")

@my_bot.command()
async def test(*args):
    return await my_bot.say("I copy")

@my_bot.command()
async def time(*args)
    clock = time.now()
    return await my_bot.say("The current time is " clock + ".")

@my_bot.command()
async def remember(*args):
    f = open("remember.txt", "w+")
    
    for x in args:
        if x == args[-1]:
            f.write(x)
        else:
            f.write(x + " ")
Ejemplo n.º 4
0
def setup(bot: commands.Bot):
    logging.info('Setting up Misc extension')
    bot.add_cog(Misc(bot))
    logging.info('Done setting up Misc extension')
def setup(bot: commands.Bot):
    bot.add_cog(ServerConfiguration(bot))
Ejemplo n.º 6
0
def setup(bot: commands.Bot):
    bot.add_cog(c237(bot))
Ejemplo n.º 7
0
def setup(bot: commands.Bot):
    bot.add_cog(Test(bot))
Ejemplo n.º 8
0
Archivo: date.py Proyecto: jai-x/apollo
def setup(bot: Bot):
    bot.add_cog(Date(bot))
Ejemplo n.º 9
0
import os
import discord
from discord.ext import commands
from discord.utils import get
from dotenv import load_dotenv
from discord.ext.commands import Bot

load_dotenv()
DISCORD_TOKEN = os.getenv("discord_token")

client = discord.Client()
bot = Bot(command_prefix='!')


@client.event
async def on_ready():
    print(f'{client.user} has come to regulate.')


@client.event
async def on_message(message):
    # add role when exact phrase is entered anywhere
    member = message.author
    if message.content == "I, ${member}, pledge to give my body and soul to":
        role = discord.utils.get(member.guild.roles.get('Member'))
        await member.add_roles(role)


# start the bot
bot.run(DISCORD_TOKEN)
Ejemplo n.º 10
0
def setup(bot: cmds.Bot):
    bot.add_cog(WikiCog(bot))
Ejemplo n.º 11
0
async def _setup(bot: Bot):
    await bot.wait_until_ready()
    cog = SelfRoles(bot)
    await cog._init()
    log.info("adding SelfRoles cog")
    bot.add_cog(cog)
Ejemplo n.º 12
0
def teardown(bot: Bot):
    log.info("removing SelfRoles cog")
    bot.remove_cog(SelfRoles.__name__)
Ejemplo n.º 13
0
def setup(bot: commands.Bot) -> None:
    """Cog loader for pride anthem."""
    bot.add_cog(PrideAnthem(bot))
Ejemplo n.º 14
0
def setup(bot: commands.Bot):
    bot.add_cog(Core(bot))
Ejemplo n.º 15
0
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# walker
"""A bot to list all members of a server."""
import sys
import discord
from discord.ext import commands
from discord.ext.commands import Bot

bot = Bot(command_prefix=">")


@bot.event
async def on_ready():
    print('bot login>', )
    print('  bot.user.name: ', bot.user.name)
    print('  bot.user.id:   ', bot.user.id)


@bot.event
async def on_command_error(error, ctx):
    if isinstance(error, commands.CommandNotFound):
        return
    else:
        print(error)


@bot.command(pass_context=True)
async def lists(ctx):
    isAdmin = ctx.message.channel.permissions_for(
        ctx.message.author).administrator
Ejemplo n.º 16
0
def setup(bot: Bot) -> None:
    bot.add_cog(Basic(bot))
    log.info("{} cog loaded".format(__name__))
Ejemplo n.º 17
0
def CreateBot(TriggerPrefix):
    ''' Creates a Bot, DUH '''
    return Bot(command_prefix=TriggerPrefix)
Ejemplo n.º 18
0
from discord.ext.commands import Bot
from discord import User
import discord
import asyncio
from Codenames import Game
from ImageGenerator import BoardGenerator

prefix = "!"
bot = Bot(command_prefix=prefix)

boardgen = BoardGenerator()
cngames = {}

@bot.event
async def on_ready():
    print("Everything's all ready to go~")

#
#@bot.event
#async def on_message(message):
#    print("The message's content was", message.content)
async def saystatus(ctx,game,dm=True):
	#boardgen.makeBoard(game.getBoardArray())
	#await bot.send_file(ctx.message.channel,"Resources/board.jpg")
	await bot.send_file(ctx.message.channel,boardgen.makeBoard(game.getBoardArray()))

	if(dm):
		await bot.send_message(game.getBlueCM(), game.getGameState())
		await bot.send_message(game.getRedCM(), game.getGameState())

@bot.command(pass_context=True)
Ejemplo n.º 19
0
#!/usr/bin/env python3

import asyncio
import io
from types import CoroutineType
import html as html_lib

import discord
from discord.ext.commands import Bot

import compo
import http_server

dm_reminder = "_Ahem._ DM me to use this command."
client = Bot(description="Musical Voting Platform",
             pm_help=False, command_prefix="vote!")
test_mode = False
postentries_channel = 0
notify_admins_channel = 0


def url_prefix() -> str:
    """
    Returns a URL prefix that changes depending on whether the bot is being
    tested or is being used in production.

    Returns
    -------
    str
        The URL of the test server if in test mode, and the production server
        URL otherwise.
Ejemplo n.º 20
0
def setup(bot: Bot) -> None:
    bot.add_cog(Maple(bot))
    log.info('{} cog loaded'.format(__name__))
Ejemplo n.º 21
0
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from discord.utils import get
import math
from simpleeval import simple_eval
import fractions as frac
from classes import *

bot = Bot(command_prefix="!")

class_match = [
    ('\[[0-9,\/\+\-\−]{1,}\][\+\−\-][st]\*\[[0-9,\/\+\-\−]{1,}\]', Vectorized),
    ('\[([0-9\/\-\−]{0,}[\+\-\−]?[0-9]{0,}[\*⋅]?[a-z][\+\-\−]?[0-9\/\-\−]{0,},){1,}[0-9\/\-\−]{0,}[\+\-\−]?[0-9\/]{0,}[\*⋅]?[a-z][\+\-\−]?[0-9\/\-\−]{0,}\]',
     Parameterized), ('y=[0-9\/\-\−]{0,}x?[\+\−\-]?[0-9\/\-\−]{0,}', SlopeY),
    ('[0-9\/\-\−]{0,}?\*?[xy][\+\-\−][0-9\/\-\−]{0,}?\*?[xy][\+\-\−]?[0-9\/\-\−]{0,}(=0)?',
     Cartesian)
]

moodle_help_id = 0

variable_storage = {}
results = {}


def generic_parse(s):
    s = clean(s)
    for m, c in class_match:
        if (re.match(m, s) is not None):
            return c.parse(s)
    return -1
Ejemplo n.º 22
0
import asyncio

from time import strftime

from discord import Embed
from discord.ext.commands import Bot

from Bot.KDE.login import Login
from Bot.KDE.cogs_manager import load_cogs
from Bot.KDE.constants import status_channels, kde_servers
from Bot.KDE.ark_server_requests import main

bot = Bot(command_prefix='!')
bot.remove_command('help')


async def my_background_task():
    await bot.wait_until_ready()

    while not bot.is_closed:
        x = [f'{main(server, True)} :x:' if 'Offline' in main(server, True) else f'{main(server, True)} :o:' for server
             in kde_servers.values()]

        status = Embed(title='__**Server Status**__', )
        status.set_footer(text=f'Last check was -> {strftime("%c")}  - Every/Cada : 5 minutes')
        for new in x:
            status.add_field(name=new, value='\u200b', inline=False)

        for channel, message in status_channels.items():
            m = await bot.get_message(bot.get_channel(channel), message)
            await bot.edit_message(m, new_content='', embed=status)
Ejemplo n.º 23
0
import discord
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
import sys
import sqlite3
import datetime

# connect db
conn = sqlite3.connect('birthdays.db')
db = conn.cursor()

# init client
client = Bot(description="Birthday Bot by iggnore#0001", command_prefix="<", pm_help = False)

# open private key file
key_file = open('./discord_key.txt', 'r')
if not key_file:
	print('File discord_key.txt can\'t be found')
	sys.exit(0)

# read private key from file
api_key = key_file.read().splitlines()[0]
if not api_key:
	print('No API key in discord_key.txt')
	sys.exit(0)

# close private key file
key_file.close()
Ejemplo n.º 24
0
#!/usr/bin/python -p

import discord
import random
import time
import os
from discord.ext.commands import Bot

my_bot = Bot(command_prefix="!")
score = {}
#All pokemons with number
pokemonNumber = {
    "Bulbasaur": "001",
    "Ivysaur": "002",
    "Venusaur": "003",
    "Charmander": "004",
    "Charmeleon": "005",
    "Charizard": "006",
    "Squirtle": "007",
    "Wartortle": "008",
    "Blastoise": "009",
    "Caterpie": "010",
    "Metapod": "011",
    "Butterfree": "012",
    "Weedle": "013",
    "Kakuna": "014",
    "Beedrill": "015",
    "Pidgey": "016",
    "Pidgeotto": "017",
    "Pidgeot": "018",
    "Rattata": "019",
Ejemplo n.º 25
0
def setup(bot: commands.Bot):
    bot.add_cog(Utils(bot))
Ejemplo n.º 26
0
def setup(bot: commands.Bot):
    bot.add_cog(ReminderCog(bot))
Ejemplo n.º 27
0
def setup(bot: commands.Bot):
    bot.add_cog(Info(bot))
 def __init__(self, bot: commands.Bot):
     print('Loading Server Configuration module...', end='')
     self.bot = bot
     self.guild_config_cog = bot.get_cog('GuildConfigCog')
     print(' Done')
Ejemplo n.º 29
0
def setup(bot: Bot):
    bot.add_command(_inspire)
    bot.add_command(_tip)
Ejemplo n.º 30
0
            response = getMeme(sub)
            break
        except:
            attempts += 1

    if attempts == 10:
        response = "There as an error with the command. Try again or try another subreddit."

    return response


def find_whole_word(w):
    return re.compile(r'\b({0})\b'.format(w), flags=re.IGNORECASE).search


bot = Bot(command_prefix='!')


@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print(datetime.now())
    print('------')


@bot.command()
async def commands():
    await bot.say('facemugs, eggs, ariel, slavery, deusvult, pirates, corey, quote, cleveland, wall,'
                  ' dinosaurs, manifest, stickbitboit, china, revolution, brandon, london, savage, victory,'
Ejemplo n.º 31
0
import discord
import discord.utils
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
import sys
import sqlite3
import MySQLdb
import datetime
import os
import json
from pprint import pprint

client = Bot(description="Butler utility for AGC Server",
             command_prefix="*",
             pm_help=False)


@client.event
async def on_ready():
    await client.wait_until_ready()
    print('Current Discord.py Version: {} | Current Python Version: {}'.format(
        discord.__version__, platform.python_version()))
    print('--------')
    print('Use this link to invite {}:'.format(client.user.name))
    print(
        'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot&permissions=8'
        .format(client.user.id))
    print('--------')
    print('You are running AGC Butler[BETA]')
Ejemplo n.º 32
0
# coding=utf-8

from logging import basicConfig, INFO

from discord.ext.commands import Bot
from discord import Game, Status

from bot.src.settings import *

basicConfig(level=INFO)
bot = Bot(max_messages=None,
          command_prefix=bot_prefix,
          owner_id=owner_id,
          description='Pomocnik sojuszu Dolina Królów',
          case_insensitive=False,
          help_command=None)


@bot.event
async def on_ready():
    # Bot-level values
    bot.version = bot_version
    bot.error_color = 0xe60000

    # Login info
    print('Logged on as: {0} ({0.id})'.format(bot.user))

    # Changing presence
    await bot.change_presence(status=Status.online,
                              activity=Game(name='Ikariam'),
                              afk=False)
Ejemplo n.º 33
0
async def get_character(name, tries=5, *, bot: commands.Bot=None) -> Optional[Character]:
    """Fetches a character from TibiaData, parses and returns a Character object

    The character object contains all the information available on Tibia.com
    Information from the user's database is also added, like owner and highscores.
    If the character can't be fetch due to a network error, an NetworkError exception is raised
    If the character doesn 't exist, None is returned.
    """
    if tries == 0:
        log.error("get_character: Couldn't fetch {0}, network error.".format(name))
        raise NetworkError()
    try:
        url = f"https://api.tibiadata.com/v2/characters/{urllib.parse.quote(name.strip(), safe='')}.json"
    except UnicodeEncodeError:
        return None
    # Fetch website
    try:
        character = CACHE_CHARACTERS[name.lower()]
    except KeyError:
        req_log.info(f"get_character({name})")
        try:
            async with aiohttp.ClientSession() as session:
                async with session.get(url) as resp:
                    content = await resp.text(encoding='ISO-8859-1')
        except Exception:
            await asyncio.sleep(config.network_retry_delay)
            return await get_character(name, tries - 1)

        content_json = json.loads(content)
        character = Character.parse_from_tibiadata(content_json)
        CACHE_CHARACTERS[name.lower()] = character
    if character is None:
        return None

    if character.house is not None:
        with closing(tibiaDatabase.cursor()) as c:
            c.execute("SELECT id FROM houses WHERE name LIKE ?", (character.house["name"].strip(),))
            result = c.fetchone()
            if result:
                character.house["houseid"] = result["id"]

    # If the character exists in the online list use data from there where possible
    try:
        for c in online_characters[character.world]:
            if c == character:
                character.level = c.level
                character.vocation = c.vocation
                break
    except KeyError:
        pass

    # Database operations
    c = userDatabase.cursor()
    # Skills from highscores
    c.execute("SELECT category, rank, value FROM highscores WHERE name LIKE ?", (character.name,))
    results = c.fetchall()
    if len(results) > 0:
        character.highscores = results

    # Check if this user was recently renamed, and update old reference to this
    for old_name in character.former_names:
        c.execute("SELECT id FROM chars WHERE name LIKE ? LIMIT 1", (old_name, ))
        result = c.fetchone()
        if result:
            with userDatabase as conn:
                conn.execute("UPDATE chars SET name = ? WHERE id = ?", (character.name, result["id"]))
                log.info("{0} was renamed to {1} during get_character()".format(old_name, character.name))

    # Discord owner
    c.execute("SELECT user_id, vocation, name, id, world, guild FROM chars WHERE name LIKE ? OR name LIKE ?",
              (name, character.name))
    result = c.fetchone()
    if result is None:
        # Untracked character
        return character

    character.owner = result["user_id"]
    if result["vocation"] != character.vocation:
        with userDatabase as conn:
            conn.execute("UPDATE chars SET vocation = ? WHERE id = ?", (character.vocation, result["id"],))
            log.info("{0}'s vocation was set to {1} from {2} during get_character()".format(character.name,
                                                                                                    character.vocation,
                                                                                                    result["vocation"]))
    # This condition PROBABLY can't be met again
    if result["name"] != character.name:
        with userDatabase as conn:
            conn.execute("UPDATE chars SET name = ? WHERE id = ?", (character.name, result["id"],))
            log.info("{0} was renamed to {1} during get_character()".format(result["name"], character.name))

    if result["world"] != character.world:
        with userDatabase as conn:
            conn.execute("UPDATE chars SET world = ? WHERE id = ?", (character.world, result["id"],))
            log.info("{0}'s world was set to {1} from {2} during get_character()".format(character.name,
                                                                                                 character.world,
                                                                                                 result["world"]))
    if character.guild is not None and result["guild"] != character.guild["name"]:
        with userDatabase as conn:
            conn.execute("UPDATE chars SET guild = ? WHERE id = ?", (character.guild["name"], result["id"],))
            log.info("{0}'s guild was set to {1} from {2} during get_character()".format(character.name,
                                                                                                 character.guild["name"],
                                                                                                 result["guild"]))
            if bot is not None:
                bot.dispatch("character_change", character.owner)
    if character.guild is None and result["guild"] is not None:
        with userDatabase as conn:
            conn.execute("UPDATE chars SET guild = ? WHERE id = ?", (None, result["id"],))
            log.info("{0}'s guild was set to {1} from {2} during get_character()".format(character.name,
                                                                                                 None,
                                                                                                 result["guild"]))
            if bot is not None:
                bot.dispatch("character_change", character.owner)
        
    return character
Ejemplo n.º 34
0

#
# Game-Bot.py contains some functions based
#   on Rapptz's Discord.py's bot examples
#
#   https://github.com/Rapptz/discord.py
#

# os.environ["GAME_BOT_TOKEN"] = "TOKEN"
# [Optional] Set your Bot token directly through the code

base_url = "http://store.steampowered.com/search/suggest"
appid_regex = re.compile("steam/apps/([0-9]+)/")

client = Bot(command_prefix='!')  # Creating bot instance

logger = logging.getLogger('game_bot')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(
    filename='game_bot.log',
    encoding='utf-8',
    mode='a')
handler.setFormatter(logging.Formatter(
    '%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)


# This code is from Hugop#2950 on the "Discord Bot List" server
# This code provides provides the number of servers Game-Bot is
# running on for DiscordBots.org's API.
Ejemplo n.º 35
0
def setup(bot: commands.Bot):
    bot.add_cog(Player(bot))
Ejemplo n.º 36
0
def setup(bot: cmds.Bot):
    bot.add_cog(RandCog(bot))
Ejemplo n.º 37
0
def setup(bot: commands.Bot):
    bot.add_cog(LogChecker(bot))
Ejemplo n.º 38
0
Archivo: midi.py Proyecto: lkmnds/jose
def setup(bot: commands.Bot):
    bot.add_cog(MIDI(bot))
Ejemplo n.º 39
0
def setup_bot(bot: Bot) -> None:
    bot.load_extension("cogs.codesandbox")
    # bot.load_extension("cogs.coding")
    bot.load_extension("cogs.commands")
    bot.load_extension("cogs.converters")
    bot.load_extension("cogs.custom")
    bot.load_extension("cogs.emotes")
    bot.load_extension("cogs.events")
    bot.load_extension("cogs.fun")
    bot.load_extension("cogs.games")
    bot.load_extension("cogs.infog")
    bot.load_extension("cogs.moderation")
    bot.load_extension("cogs.study")
    bot.load_extension("cogs.sudo")
    bot.load_extension("cogs.support")
    bot.load_extension("cogs.tools")

    bot.run(TOKEN)
Ejemplo n.º 40
0
import asyncio
import json
import os

from discord.ext.commands import Bot

from fogeybot.database import Database
from fogeybot.hotslogs_api import HotsLogsAPI

from fogeybot.cogs.general.cog import GeneralCommands
from fogeybot.cogs.pickup.cog import PickupCommands
from fogeybot.cogs.users import UserCommands

bot = Bot(command_prefix="!", description="I am FogeyBot! I help start pickup games, and do other bot-y things.")

@bot.event
async def on_ready():
    print("FogeyBot: logged in as %s" % (bot.user.name))

client_id = os.environ["DISCORD_CLIENT_ID"]
token = os.environ["DISCORD_TOKEN"]
channel = os.environ.get("DISCORD_CHANNEL")
uri = os.environ["MONGO_URI"]

db = Database(uri)
asyncio.get_event_loop().run_until_complete(db.test_connection())

api = HotsLogsAPI()

bot.add_cog(GeneralCommands(bot))
bot.add_cog(PickupCommands(bot, api, db, channel))
Ejemplo n.º 41
0
def setup(bot: commands.Bot):
    bot.add_cog(c302(bot))
Ejemplo n.º 42
0
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import discord
import json

startup_extensions = ["help", "moderation", "general", "featured"]

bot = Bot (command_prefix=commands.when_mentioned_or('%'))

@bot.event
async def on_command_error(error, ctx):
        cmd = ctx.command
        if isinstance(error, commands.BadArgument):
        	await bot.send_message(ctx.message.channel, "**ERROR in the Command {}:**```py\n{}```".format(cmd, error))
        if isinstance(error, commands.CommandInvokeError):
        	await bot.send_message(ctx.message.channel, "**ERROR in the Command {}:**```py\n{}```".format(cmd, error))
        if isinstance(error, commands.CommandOnCooldown):
        	await bot.send_message(ctx.message.channel, "⏱ **This command is currently under cooldown. Try again in {:.2f} hours!**".format(error.retry_after / 3600))
        else:
            print(error)

@bot.event
async def on_ready():
	print('Logged in as '+bot.user.name+' (ID:'+bot.user.id+') | Connected to '+str(len(bot.servers))+' servers | Connected to '+str(len(set(bot.get_all_members())))+' users')
	print('--------')
	return await bot.change_presence(game=discord.Game(name='Bots for Discord', type=3))

@bot.event
async def on_message(message):
    allowed = ["308358617458016256", "374071874222686211", "374074135506190349"]
Ejemplo n.º 43
0
def setup(bot: commands.Bot):
    c = AnticipationNotifications(bot)
    bot.add_cog(c)
Ejemplo n.º 44
0
import random
import asyncio
import requests
from discord import Game
from discord.ext.commands import Bot

BOT_PREFIX = ("?", "!")
TOKEN = "XXXXSECRETTOKENXXX"  # Get at discordapp.com/developers/applications/me

client = Bot(command_prefix=BOT_PREFIX)

@client.command(name='8ball',
                description="Answers a yes/no question.",
                brief="Answers from the beyond.",
                aliases=['eight_ball', 'eightball', '8-ball'],
                pass_context=True)
async def eight_ball(context):
    possible_responses = [
        'That is a resounding no',
        'It is not looking likely',
        'Too hard to tell',
        'It is quite possible',
        'Definitely',
    ]
    await client.say(random.choice(possible_responses) + ", " + context.message.author.mention)


@client.command()
async def square(number):
    squared_value = int(number) * int(number)
    await client.say(str(number) + " squared is " + str(squared_value))
Ejemplo n.º 45
0
def setup(bot: commands.Bot):
    bot.add_cog(c191(bot))
Ejemplo n.º 46
0
def setup(bot: commands.Bot):
    logging.info('Setting up Uptime extension')
    bot.add_cog(Uptime(bot))
    logging.info('Done setting up uptime extension')
Ejemplo n.º 47
0
import pyowm
import discord
from discord.ext import commands
from discord.ext.commands import Bot
owm = pyowm.OWM('cd1ce42897e0ce128723e6f7d8c20864')
observation = owm.weather_at_place('Ekaterinburg, RU')
w = observation.get_weather()

Bot = commands.Bot(command_prefix='!')


@Bot.event
async def on_ready():
    print("Bot online")


@Bot.command(pass_context=True)
async def weather(ctx):
    await ctx.send(w)


Bot.run('NjA2NDAyOTYwMzk3OTU5MTY4.XUfoWw.VLnjeSZhnByygTakTTni51o2lcI')