Example #1
0
import discord
import asyncio
import Actions
import Music
import atexit
from discord.ext import commands

"""
The main class that handles running the bot and its methods
"""

# Creates a bot object and adds the classes that handle user input (cogs)
bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"), description="yes")
bot.add_cog(Music.Music(bot))
bot.add_cog(Actions.Action(bot))


@bot.event
@asyncio.coroutine
def on_ready():
    # Sets the status of the bot (visible to users)
    game = discord.Game()
    game.name = "Music"
    yield from bot.change_status(game)


print("Bot Starting...")

# Requires own key, runs the bot
bot.run("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
Example #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#external dependencies: pykml (via pip)

import sys
from UserMapfunctions import *
import Actions

if __name__ == "__main__":
    action = Actions.Action(sys.argv)

    if action.type != Actions.Actions.undefined:
        kmlFilePath = getKmlFilePath()
        root = parseKml(kmlFilePath)
        Placemarks = getPlacemarks(root)
        if not action.readOnly:
            hostname = getHostname()
            lock()

        if action.type == Actions.Actions.add:
            if not nameExists(action.name, Placemarks):
                addNewPlacemark(Placemarks, hostname, action.name,
                                action.locationString, action.lat, action.lng,
                                action.country, action.desc)
            else:
                action.error = "name_taken"

        elif action.type == Actions.Actions.overwrite:
            nameNode = getNameNode(action.name, Placemarks)
            if nameNode is not None: