Ejemplo n.º 1
0
async def _on_away(self, client, tags, cmd, args):
    game = ' '.join(args)
    if game.startswith(':'):
        game = game[1:]
    ptype = (tags and tags.get('+discordapp.com/type') or '').lower()
    url   = None
    if ptype == 'watching':
        ptype = 3
    elif ptype == 'listening to':
        ptype = 2
    elif ptype == 'streaming':
        ptype = 1
        url  = 'https://www.twitch.tv/directory'
    else:
        ptype = 0

    game = discord.Activity(name = game, type = discord.ActivityType(ptype),
        url = url)
    self.debug('Changing online presence:', game)

    if tags.get('+discordapp.com/status'):
        try:
            status = discord.Status(tags['+discordapp.com/status'])
        except:
            print('WARNING: Invalid status sent to AWAY!')
            return
    else:
        status = discord.Status('online')

    await client.change_presence(activity=game, status=status)
Ejemplo n.º 2
0
async def on_ready():
    log_channel = bot.get_channel(settings['logs'])

    print(f'\n::: {ver}')

    # await bot.get_channel (settings ['channel']).send (txt_bot_online.format (ver))
    # await log_channel.send (f'{logson}\nпинг: {bot.latency}')
    # await log_channel.send ('```' + '\n'.join ([f': {i}\n:: {modules_dict [i]}' for i in modules_dict]) + '```')

    await bot.change_presence(status=discord.Status.offline)

    activ_stream = discord.Streaming(name=txt_status_2.format(
        str(len(bot.guilds))),
                                     url='https://m.twitch.tv/buster')
    actv_0 = discord.Activity(type=discord.ActivityType.watching,
                              name=txt_status_0,
                              url='https://m.twitch.tv/buster')
    actv_1 = discord.Activity(type=discord.ActivityType.listening,
                              name=txt_status_1.format(ver),
                              url='https://m.twitch.tv/buster')
    actv_2 = discord.Streaming(name=txt_status_2.format(str(len(bot.guilds))),
                               url='https://m.twitch.tv/buster')

    while True:
        await bot.change_presence(activity=actv_0,
                                  status=discord.Status("dnd"))
        await sleep(5)
        await bot.change_presence(activity=actv_1,
                                  status=discord.Status("idle"))
        await sleep(5)
        await bot.change_presence(activity=activ_stream)
        await sleep(5)
Ejemplo n.º 3
0
async def auto_status():
    while True:
        activitys = [
            "...                 Did you expect to find anything useful?",
            f"{random.choice(['Hi', 'Hello', 'Ello'])},  there{random.choice(['!', '.', '...', '!!!'])}",
            "I likey"
        ]
        statuses = ["online", "idle", "dnd", "streaming"]
        raw_status = random.choice(statuses)

        def streaming(s):
            return s == "streaming"

        if not streaming(raw_status):
            status = discord.Status(raw_status)
        else:
            status = discord.Status(random.choice(["online", "idle", "dnd"]))
            url = random.choice([
                "https://www.twitch.tv/npesta",
                "https://www.twitch.tv/juniper",
                "https://www.twitch.tv/chriso2", "https://www.twitch.tv/ "
            ])
        thing = random.choice(activitys)
        ranactivity = f"w!help | {thing}"
        if not streaming(raw_status):
            activity = discord.Activity(name=ranactivity,
                                        type=discord.ActivityType.watching)
        else:
            activity = discord.Activity(name=ranactivity,
                                        url=url,
                                        type=discord.ActivityType.streaming)
        await bot.change_presence(status=status, activity=activity)
        await asyncio.sleep(86400)
Ejemplo n.º 4
0
async def on_ready():
    global mainChannel, logsChannel, visible, databasePath, botOwner, Refresh
    mainChannel = client.get_server(
        constants.Settings.mainServerID).get_channel(
            constants.Settings.mainChannelId)
    logsChannel = client.get_server(
        constants.Settings.mainServerID).get_channel(
            constants.Settings.logsChannelId)
    print('Logged in !')

    botOwner = await client.get_user_info(
        str(constants.Settings.ownerDiscordId))
    hello = False

    if (datetime.now().strftime('%H') == "02"
            and Refresh) or ((set(sys.argv) & set(["refresh"])) and Refresh):
        await change_presence(status=discord.Status('dnd'),
                              game=discord.Game(name='Booting ...'))
        message = await client.send_message(
            mainChannel, "<:empty:317951266355544065> Updating stats ...")
        #try:
        print('Refreshing users stats ...')
        update_stats.update_all_stats(conn, cursor)
        Refresh = False
        print(" - Done")
        print('Creating new backup ...', end="")
        create_backup()
        print(" Done !")
        await client.edit_message(
            message, "<:check:317951246084341761> Updating stats ... Done !")
        # except:
        # 	await client.edit_message(message, "<:xmark:317951256889131008> Updating stats ... Fail !")
        if not set(sys.argv) & set(["dev"]):
            await client.send_message(
                mainChannel,
                "<:online:317951041838514179> Uso!<:Bot:317951180737347587> is now online !"
            )
            await change_presence(status=discord.Status('online'),
                                  game=discord.Game(name='Osu !'))
            hello = True
    if (set(sys.argv) & set(["online"])) and hello == False:
        await client.send_message(
            mainChannel,
            "<:online:317951041838514179> Uso!<:Bot:317951180737347587> is now online !"
        )
    if set(sys.argv) & set(["dev"]):
        await change_presence(status=discord.Status('idle'),
                              game=discord.Game(name='Dev mode'))
    else:
        await change_presence(status=discord.Status('online'),
                              game=discord.Game(name='o!help'))
    print('Ready !')
Ejemplo n.º 5
0
async def on_ready():
    # badly implement status lmao
    #str(DISCORD_TYPE.lower())

    if (DISCORD_TYPE == "watching"):
        await bot.change_presence(status=discord.Status(DISCORD_STATUS),
                                  activity=discord.Activity(
                                      type=discord.ActivityType.watching,
                                      name=DISCORD_STATUS_NAME))

    elif (DISCORD_TYPE == "playing"):
        await bot.change_presence(
            status=discord.Status(DISCORD_STATUS),
            activity=discord.Game(name=DISCORD_STATUS_NAME))

    elif (DISCORD_TYPE == "listening"):
        await bot.change_presence(status=discord.Status(DISCORD_STATUS),
                                  activity=discord.Activity(
                                      type=discord.ActivityType.listening,
                                      name=DISCORD_STATUS_NAME))

    elif (DISCORD_TYPE == "streaming"):
        await bot.change_presence(status=discord.Status(DISCORD_STATUS),
                                  activity=discord.Streaming(
                                      name=DISCORD_STATUS_NAME,
                                      url=DISCORD_TWITCH))

    log.info(f"Bot is ready: logged in as {bot.user.name} ({bot.user.id})")
    log.info("Checking for Pterodactyl...")
    if (str(sys.argv[1]) == 'ptero'):
        log.info("Pterodactyl Detected!")
    else:
        log.info("Pterodactyl not found.")

        @client.event
        async def on_message(message):
            if discord.message.author == discord.client.user:
                return

                help = [
                    'Hello! Welcome to the server.', 'Possible commands are:'
                    '`s!discords` - Lists all discords this bot is in.',
                    '`s!servers` - Lists all Minecraft servers this bot has access to',
                    '`s!help` - Shows this.'
                ]

                if message.content == 's!help':
                    response = help
                    await message.channel.send(response)

                    if message.author == client.user:
                        return
Ejemplo n.º 6
0
async def on_message(message):
    if (message.author == client.user): return
    status = message.guild.get_member(care).status
    if (status == discord.Status("dnd") or status == discord.Status("idle")
            or status == discord.Status("online")):
        res = random.choice(gmood)
        await message.channel.send(res)
    elif (status == discord.Status("offline")
          or status == discord.Status("invisible")):
        res = random.choice(bmood)
        await message.channel.send(res)
    if (message.content.startswith("hi")):
        await message.channel.send("Yep ive started")
Ejemplo n.º 7
0
async def change_status(message):
    print('Changing status')
    if 'ONLINE' in message.content.upper():
        await client.change_presence(game=None, status=discord.Status('online'), afk=False)
    elif 'DND' in message.content.upper():
        await client.change_presence(game=None, status=discord.Status('dnd'), afk=False)
    elif 'IDLE' in message.content.upper():
        await client.change_presence(game=None, status=discord.Status('idle'), afk=False)
    elif 'INVISIBLE' in message.content.upper():
        await client.change_presence(game=None, status=discord.Status('invisible'), afk=False)
    #else, default to returning error
    else:
        await client.send_message(message.channel,"Error: No applicable status given.")
Ejemplo n.º 8
0
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')
    bot.change_presence(game=discord.Game(name="?help"),
                        status=discord.Status("dnd"))
Ejemplo n.º 9
0
Archivo: bot.py Proyecto: Abanob61/slow
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')
    await client.change_presence(game=discord.Game(name='SlowBall'),
                                 status=discord.Status("online"))
Ejemplo n.º 10
0
 async def status(self, ctx, presence: str, status: str):
     if "Cool Kids" in [role.name for role in ctx.message.author.roles]:
         if status == "Online":
             status = "online"
         if status == "Idle":
             status = "idle"
         if status == "Offline":
             status = "offline"
         if status in banned_words:
             embed = discord.Embed(
                 description=
                 "Please do not use that kind of language for our BOT status.",
                 color=0xF00000)
         await self.bot.change_presence(
             game=discord.Game(name="" + presence),
             status=discord.Status("" + status))
         embed = discord.Embed(
             description="The BOT's Presence has been changed to " +
             presence + " - The BOT's Status has been changed to " +
             status,
             color=0xF00000)
         print(Fore.GREEN + "OK: BOT Status changed to: " + presence)
         await self.bot.say(embed=embed)
     else:
         embed = discord.Embed(description="You are not a BOT Master.",
                               color=0xF00000)
         return await self.bot.say(embed=embed)
Ejemplo n.º 11
0
async def bid_away(ctx):
    try:
        await Breakouts.change_presence(game=discord.Game(
            name="Under management", type=3),
                                        status=discord.Status("dnd"))
    except:
        print("STATUS CHANGEED TO AWAY")
Ejemplo n.º 12
0
async def on_ready():
    print("Bot details: \n------------------------------")
    print(bot.user.name)
    print(bot.user.id)
    print ("Bot is armed and ready, sir!")
    print("------------------------------")
    await bot.change_presence(game=discord.Game(name="Slap my bitch up!"), status=discord.Status("idle"))
Ejemplo n.º 13
0
async def on_ready():
    count = 0

    bot.is_ready()
    activity = discord.Game(name=random.choice(statusList))
    await bot.change_presence(activity=activity, status=discord.Status('online'))

    print('-------------------BOT LOGIN-------------------')
    print('Bot is logged in as: ')
    print('Username: '******'User ID: ' + str(bot.user.id))
    print('Time: ' + str(datetime.datetime.now()))
    print('-------------------BOT READY-------------------')
    print('BOT LOGS:')

    print(str(datetime.datetime.now()) + ': Status Timer initializing...')
    statusTimerDelta = datetime.timedelta(minutes=30)
    statusTimerStart = datetime.datetime.now()

    while True:
        await asyncio.sleep(0.9)
        statusTimerCheck = datetime.datetime.now() - statusTimerStart
        if statusTimerCheck >= statusTimerDelta:
            print(str(datetime.datetime.now()) + ': Status Timer complete...')
            activity = discord.Game(name=random.choice(statusList))
            await bot.change_presence(activity=activity)
            statusTimerStart = datetime.datetime.now()
            print(str(datetime.datetime.now()) + ': Status Changed! Starting new Status Timer.')
Ejemplo n.º 14
0
async def on_ready():
    global startlat
    await bot.change_presence(
        activity=discord.Game(name='on ❁| smol sunflowers |❁'),
        status=discord.Status('online'))
    tmplat = str(round(bot.latency * 1000, 0))
    startlat = f'{tmplat[0:len(tmplat)-2]}ms'
Ejemplo n.º 15
0
 def __init__(self):
     super().__init__(command_prefix=_get_prefix,
                      activity=discord.Game(name='Updating...'),
                      status=discord.Status('dnd'))
     self.remove_command("help")
     self._load_extensions()
     self.colour = 0x87DAB
Ejemplo n.º 16
0
async def on_ready():
    global startlat
    await bot.change_presence(activity=discord.Game(name='...'),
                              status=discord.Status('dnd'))
    tmplat = str(round(bot.latency * 1000, 0))
    startlat = f'{tmplat[0:len(tmplat)-2]}ms'
    print(f"ready with lat of {startlat}")
Ejemplo n.º 17
0
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')
    print(about_msg)

    # Create giveaway section in config if it doesn't exist
    config = SafeConfigParser()
    config.read('config.ini')
    if not config.has_section('giveaway'):
        config.add_section('giveaway')
        config.set('giveaway', 'rank_restriction', 'False')

        with open('config.ini', 'w') as f:
            config.write(f)

    gw2 = discord.Game(name="Guild Wars 2", type=0)
    status = discord.Status("online")
    await client.change_presence(game=gw2, status=status)

    # Check if a giveaway was going on before the previous boot
    global giveaway_is_running
    resultset = session.query(Giveaway)
    if resultset.count() > 0:
        giveaway_is_running = True
Ejemplo n.º 18
0
async def on_ready():
    bot.loop.create_task(bg())
    print(bot.user.name)
    await bot.change_presence(game=discord.Game(
        name=
        "Mua Gaming Gear, Console, Áo TTG tại TTGShop  27 Võ Văn Dũng, Đống Đa, Hà Nội. Website: ttgshop.vn"
    ),
                              status=discord.Status('dnd'))
Ejemplo n.º 19
0
async def on_ready():
    print("Systems online, Monokuma ready for combat!")
    print("Current bot user = "******"Current bot ID = " + bot.user.id)
    await bot.change_presence(
        game=discord.Game(name='k!help', type=2),
        status=discord.Status('online')
    )  #you could set the playing status to anything you want
Ejemplo n.º 20
0
async def on_ready():
    print(f"{bot.user.name} is running")
    print("-" * len(bot.user.name + " is running"))
    await bot.change_presence(
        status=discord.Status('online'),
        activity=discord.Game(f"use {bot.command_prefix}help"))
    for i in cogs:
        bot.load_extension(f"cogs.{i}")
Ejemplo n.º 21
0
async def on_ready():
    await bot.change_presence(game=discord.Game(name="c!help for commands",
                                                type=0),
                              status=discord.Status("online"))
    message = ("Bot started successfully!")
    user = await bot.get_user_info("284398011310800898")
    await bot.send_message(user, message)
    print(message)
Ejemplo n.º 22
0
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')
    await bot.change_presence(game=discord.Game(name='+helpverify'),
                              status=discord.Status('online'),
                              afk=False)
Ejemplo n.º 23
0
async def on_ready():
    print(bot.user.name)
    print("Connecting...")
    await bot.change_presence(game=discord.Game(
        name=
        ",help | ,sim | Bot được phát triển bởi Kido, dựa trên ý tưởng của Thịnh. Have fun!"
    ),
                              status=discord.Status('idle'))
Ejemplo n.º 24
0
 async def set_status(self, ctx, status):
     """Sets bot online status"""
     if status in status_options:
         await self.bot.change_presence(status=discord.Status(status))
         await ctx.send(f"Changed status to {status}")
     else:
         await ctx.send(
             f"not a valid status, valid status options are: {array_to_comma_list(status_options)}"
         )
Ejemplo n.º 25
0
 async def shutdown(self, ctx: commands.Context):
     """Eteint le bot"""
     m = await ctx.send("Cleaning up...")
     await self.cleanup_workspace()
     await m.edit(content="Shutting down...")
     await self.bot.change_presence(status=discord.Status('offline'))
     self.bot.log.info("Bot Shut Down")
     await self.bot.logout()
     await self.bot.close()
Ejemplo n.º 26
0
async def on_ready():
    print("Loading...")
    print("Done!")
    await bot.change_presence(game=discord.Game(name="!help"),
                              status=discord.Status("online"),
                              afk=False)
    print("M0DB0T by ST3VI3 RICHI3#5015")
    print("M0DB0T running on user name: " + bot.user.name +
          " and on the ID: " + bot.user.id)
Ejemplo n.º 27
0
async def on_message(message):
    args = message.content.split(" ")
    if args[0] == prefix[0] + "jeu":
        if len(args) > 1:
            await client.change_presence(activity=discord.Game(name=args[1]),
                                         status=discord.Status("offline"))
            await message.channel.send("Jeu changé pour : " + args[1])
        else:
            await message.channel.send("Veuillez mettre un jeu !")
Ejemplo n.º 28
0
 async def shutdown(self, ctx):
     """Eteint le bot"""
     m = await ctx.send("Nettoyage de l'espace de travail...")
     await self.cleanup_workspace()
     await m.edit(content="Bot en voie d'extinction")
     await self.bot.change_presence(status=discord.Status('offline'))
     self.bot.log.info("Fermeture du bot")
     await self.bot.logout()
     await self.bot.close()
Ejemplo n.º 29
0
async def on_ready():
    game = application['game']
    status = application['status']
    afk = application['afk']
    if len(game) > 0 or len(status) > 0:
        await client.change_presence(game=discord.Game(name=str(game)),
                                     status=discord.Status(str(status)),
                                     afk=afk)
    print("Discord client (v{}) has been started!".format(discord.__version__))
Ejemplo n.º 30
0
 def __init__(self):
     super().__init__(
         command_prefix=commands.when_mentioned_or('a!'),
         activity=discord.Game(name='Updating...'),
         status=discord.Status('dnd')
         )
     self.remove_command("help")
     self._load_extensions()
     self.colour = 0xff0004