async def set_status(status): if status is None or status.strip() == "": activity = None elif "#" in status: ssplit = status.split("#") emoji = ssplit[0] status = ssplit[1] activity = discord.CustomActivity(status, emoji=emoji) else: activity = discord.CustomActivity(status) print("[ADMIN] - Updating status:", status, activity) await BOT.change_presence(activity=activity)
async def activity_presence(self, ctx): """ Set a Random Status """ async with self.bot.db.acquire() as conn: async with conn.transaction(): r = await conn.fetchrow(''' SELECT name, other->'emoji' as emoji FROM activities WHERE type = 4 ORDER BY RANDOM() LIMIT 1 ''') emoji = r['emoji'] if emoji is not None: emoji = self.bot.get_emoji(emoji) status = discord.CustomActivity(name=r['name'], emoji=emoji) await self.bot.change_presence(activity=status) emoji_name = status.emoji.name if status.emoji is not None else '' logging.info(f'Set Status to: "{emoji_name}" "{status.name}"!') await ctx.send(f'Status: "{status.emoji}" "{status.name}"!')
async def set(self, ctx, status: str): # subcommand to set the current bot status await self.bot.change_presence( status=discord.Status.idle, activity=discord.CustomActivity(name=status)) await self.bot.get_channel(self.masterLog ).send(f"**Changed status**: To {status}")
async def on_ready(self): if not hasattr(self, 'uptime'): self.uptime = datetime.datetime.utcnow() log.info(f'Ready: {self.user} (ID: {self.user.id})') log.info(f'Servers: {len(self.guilds)}') log.info('========================================') self.change_presence(activity=discord.CustomActivity(',,help'))
async def on_ready(): print("Logged in as") print(bot.user.name) print(bot.user.id) print(f"Running python version {python_version()}") print("------") await bot.change_presence(activity=discord.CustomActivity(name="coping"))
async def on_ready(): print('Logged in as') print(monsoon.user.name) print(monsoon.user.id) print('------') game = discord.CustomActivity(name="monsoon.rain-ffxiv.com") await monsoon.change_presence(activity=game)
async def on_ready(): channel = bot.get_channel(message_channel) print('Logged onto Discord as {0.user}'.format(bot)) doing = discord.CustomActivity(name="Checking Server Infomation") await bot.change_presence(status=discord.Status.online, activity=doing) bot.loop.create_task(autoRun()) msgs = await channel.history().flatten() await channel.delete_messages(msgs)
async def on_ready(self): print('Logged on as {0}!'.format(self.user)) """ opus 読み込めないため一旦消し if not discord.opus.is_loaded(): discord.opus.load_opus("heroku-buildpack-libopus") print("opus lib is loaded :", discord.opus.is_loaded()) """ self.owner_id = DISCORD_OWNER_ID cusActivity = discord.CustomActivity("BEYOND THE PIEN", emoji="🥺") await self.user.change_presence(activity=cusActivity)
async def on_ready(): print('Connected as {0.user} on these servers: '.format(client)) for g in client.guilds: print(' - ' + g.name) print('+--------------------------------------------------+') await client.change_presence(activity=discord.CustomActivity("Studying #the-bible-of-evan")) await praise_schedule(config.TIME_INT) return
async def set_status(self, status, song=None): if status == "playing": self.currently_playing = song self.state = "playing" game = discord.Game(song.title) await self.client.change_presence(status=discord.Status.online, activity=game) elif status == "idle": game = discord.CustomActivity("vibin") await self.client.change_presence(status=discord.Status.idle, activity=game) self.state = "idle" elif status == "paused": if self.state != "playing": await self.send_error("Can't pause, not playing") return self.voice_client.pause() game = discord.CustomActivity("paused") await self.client.change_presence(status=discord.Status.idle, activity=game) self.state = "paused" elif status == "stopped": # put the currently playing thing in the queue if self.currently_playing is not None: self.music_queues[self.current_queue].insert( 0, self.currently_playing) # remove it from currently playing self.currently_playing = None # stop playing if self.voice_client is not None: self.voice_client.stop() game = discord.CustomActivity("stopped") await self.client.change_presence(status=discord.Status.idle, activity=game) self.state = "stopped" else: logger.warning("set_status given bad value: {}".format(status))
async def on_ready(): print('------') print('Logged in as') print(bot.user.name) print(bot.user.id) print(datetime.now()) print('------') for server in bot.guilds: print(server.name) print(server.id) print('------') await bot.change_presence(activity=discord.CustomActivity(name="-help"))
async def on_ready(self): print(discord.__version__) print('Logged on as', self.user) varStatus = "Text Status" varEmoji = "🐻" #varActivity = discord.Activity(type=discord.ActivityType.custom, name=varEmoji+" "+varStatus, state=varEmoji+" "+varStatus) varActivity = discord.CustomActivity( name=varStatus, state=varStatus, emoji=discord.PartialEmoji(name=varEmoji)) await client.change_presence(status=discord.Status.online, activity=varActivity)
async def on_ready(): print(str(client.user) + " Has Started And Is Connected To Discord") guilds = await client.fetch_guilds(limit=150).flatten() for guild in guilds: try: id = ServerSettings[str(guild.id)] except KeyError: ServerSettings.update({str(guild.id): {"ServerSettings": {}}}) threads.start_new(autoSave, (0, 0)) displayed = discord.CustomActivity(name="Being Developed") await client.change_presence(status=discord.Status.online, activity=displayed) currentMode = "Running" clientName = str(client.user) await client.loop.create_task(live_stats(livestatesChannel))
async def check_user_count(self): try: status = self.mc_server.status() except: return count = status.players.online change = count != self.user_count if change: status = discord.Status.online if count == 0: status = discord.Status.idle activity = discord.CustomActivity("Miners {}".format(count)) await self.change_presence(status=status, activity=activity)
async def change_to(self, event_type=None, activity_name=None, **kwargs): if activity_name is None: raise ValueError("No activity name") if event_type == "regarde": await self.bot.change_presence( activity=discord.Activity(type=3, name=activity_name, **kwargs) ) elif event_type == "écoute": await self.bot.change_presence( activity=discord.Activity(type=2, name=activity_name, **kwargs) ) elif event_type == "joue": await self.bot.change_presence(activity=discord.Game( name=activity_name)) else: await self.bot.change_presence( activity=discord.CustomActivity(name=activity_name, **kwargs))
async def on_ready(self): print('Logged in as') print(self.user.name) print(self.user.id) print('------') self.channel = self.get_channel(int( os.environ['DISCORD_CHANNEL'])) # channel ID goes here self.mine_manager = os.environ["MINE_MANAGER"] self.mc_server = MinecraftServer(os.environ['MC_SERVER']) # await self.channel.send(WELCOME_MSG) activity = discord.CustomActivity("Miners: {}".format(0)) await self.change_presence(status=discord.Status.idle, activity=activity) self.mc_is_up = True self.user_count = 0 self.current_players = set() # create the background task and run it in the background self.bg_task = self.loop.create_task(self.my_background_task())
async def on_ready(): # if env is not dev the load regular cogs if common.getEnvironment() != 'dev': db = database.Database() # update bot start time db.updateBotStartTime() # guild for guilds in bot.guilds: guild.updateGuidInfo(guilds) for module in modules_prod: bot.load_extension(module) # load cogs which are are development else: for module in modules_dev: bot.load_extension(module) await bot.change_presence( status=discord.Status.online, activity=discord.CustomActivity(name='Testing mode >.<'))
async def ex(args, message, client, invoke): if len(args) >= 2: act_type = args[0].lower() activity = " ".join(args[1:]) if act_type == "game": await client.change_presence(activity=discord.Game(name=activity)) config.CONFIG["ACTIVITY"] = {"GAME": activity} if act_type == "streaming": await client.change_presence(activity=discord.Streaming( name=activity)) config.CONFIG["ACTIVITY"] = {"STREAMING": activity} if act_type == "custom": await client.change_presence(activity=discord.CustomActivity( name=activity)) config.CONFIG["ACTIVITY"] = {"CUSTOM": activity} await Logger.info("Successfully set activity (%s) to: '%s'" % (act_type, activity)) else: PREFIX = db.fetch_prefix(message.guild.id) await Logger.error("Usage: `%sactivity <game/streaming/custom> text`" % PREFIX)
def main(): p = argparse.ArgumentParser() p.add_argument("--config", required=True, help="Path to configuration file") args = p.parse_args() with open(args.config, "r") as f: config = json.load(f) activity = discord.CustomActivity("DM me !help or !invite") client = discord.Client(activity=activity) message_handler = MessageHandler(config, client) @client.event async def on_ready(): print("Logged in as", client.user.name) @client.event async def on_message(message): await message_handler.handle(message) client.run(config["token"])
async def on_ready(): print('The bot has started completely!') activity = discord.CustomActivity("I'm getting experimented everyday :<") await bot.change_presence(activity=activity, status=Status.online) reboot_file = Path(utils.current_dir(), 'reboot.json') if not reboot_file.exists(): return with open(reboot_file) as file: data = json.loads(file.read()) os.remove(reboot_file) last_guild: Guild = bot.get_guild(data['guild']) if not last_guild: return last_channel: TextChannel = last_guild.get_channel(data['channel']) if not last_channel: return await last_channel.send('The bot is now back and running!')
embed.add_field(name="Server Uptime", value=str(serverUptime), inline=False) embed.add_field(name="Client Uptime", value=str(clientUptime), inline=False) embed.set_footer(text="Version: " + str(version) + " • " + str(time.ctime())) if oldMessage: await oldMessage.edit(embed=embed) else: oldMessage = await channel.send(embed=embed) await asyncio.sleep(5) except Exception as e: print("LiveStats Error: " + str(e)) await asyncio.sleep(10) await client.loop.create_task(live_stats(int(livestatesChannel))) DEFAULT_PREFIX = "-" displayed = discord.CustomActivity(name="Being Developed") client = commands.Bot(dynamicPrefix, case_insensitive=True, activity=displayed, max_messages=2500) client.add_cog(ManagmentModule(client)) cogs["ManagementModule"] = {"Running": "No Problems"} cogs["SystemUtilitys"] = {"Running": "No Problems"} totalModules += 2 time.sleep(1) client.remove_command('help') for ext in os.listdir(CogLocations): if not ext.startswith(('_', '.', '-')): print("Loading Extenstion: " + str(ext[:-3])) try: totalModules += 1 client.load_extension('Cogs.' + ext[:-3]) cogs[str(ext[:-3])] = {"Running": "No Problems"} except Exception as e:
async def on_ready(): print('We have logged in as {0.user}'.format(bot)) await bot.change_presence(activity=discord.CustomActivity( name='Policing OutpostMC')) await writeServer(bot)
async def on_connect(): print("Module 1 status OK") #channelup = cabal.get_channel(695286021176426536) #await channelup.send("``Подключён``") await cabal.change_presence(status=discord.Status.online, activity=discord.CustomActivity("123"))
async def on_ready(): await bot.change_presence(activity=discord.CustomActivity( name='{0}help'.format(PREFIX)))
# Bot for the TechRock Discord import discord from bot.bot import Bot from bot.constants import Bot as BotConfig from bot.variables import _prefix bot = Bot(command_prefix=_prefix, activity=discord.CustomActivity(name='Welcome to BE'), case_insensitive=True) # Commands, bot function bot.load_extension('bot.cogs.error_handler') bot.load_extension('bot.cogs.help') bot.load_extension('bot.cogs.guilds') # TechRock Cogs bot.load_extension('bot.cogs.server') bot.load_extension('bot.cogs.democracy') # Feature cogs bot.load_extension('bot.cogs.memes') bot.load_extension('bot.cogs.status') bot.load_extension('bot.cogs.mcbecl') bot.load_extension('bot.cogs.embeder') bot.run(BotConfig.token)
async def on_ready(): print(bot.user.name," has connected") await bot.change_presence(status=discord.Status.online, activity=discord.CustomActivity("just vibing"))
async def on_ready(): await bot.change_presence(activity=discord.CustomActivity(name=credentials['message_activity'])) print("I'm on the case") logging.info("bot running")
ModulePath = os.path.join(os.path.dirname(os.path.realpath(__file__)), ModuleFolder) builtins.db = dataset.connect('sqlite:///data.sqlite') builtins.db.begin() builtins.Utb = builtins.db["user"] builtins.Gtb = builtins.db["guilds"] builtins.Rtb = builtins.db["roles"] builtins.UGtb = builtins.db["UsersGuilds"] builtins.URtb = builtins.db["UsersRoles"] builtins.ACtb = builtins.db["ActiveCases"] builtins.db.commit() builtins.Module = [[f.replace(".py", ""), 0] for f in os.listdir(ModulePath) if not "__" in f] builtins.client = discord.Client( activity=discord.CustomActivity("All for Gender Equality 👍")) builtins.events = { "on_ready": [], "on_member_join": [], "on_message": [], "on_voice_state_update": [], "on_reaction_add": [], "on_member_update": [], "on_guild_join": [], "on_guild_update": [], "on_guild_role_delete": [], "on_member_ban": [], "on_member_unban": [], "on_relationship_update": [] }
async def on_ready(self): print(f"Bot has logged in as {self.client.user} and is ready!", flush=True) await self.client.change_presence(activity=discord.CustomActivity( name=f"Listening to {self.client.command_prefix}"))
async def on_ready(): await client.change_presence(status=discord.Status.idle, activity = discord.CustomActivity('PEAKY BLINDERS')) print('u son of bitch ,I am in ,As {0.user}'.format(client))