Ejemplo n.º 1
0
 async def change_activity(self, ctx: commands.Context, Type: str,
                           *act: str):
     """Change l'activité du bot (play,watch,listen,stream)"""
     act = " ".join(act)
     if Type in ['game', 'play']:
         await self.bot.change_presence(activity=nextcord.Game(name=act))
     elif Type in ['watch', 'see']:
         await self.bot.change_presence(
             activity=nextcord.Activity(type=nextcord.ActivityType.watching,
                                        name=act,
                                        timestamps={'start': time.time()}))
     elif Type in ['listen']:
         await self.bot.change_presence(activity=nextcord.Activity(
             type=nextcord.ActivityType.listening,
             name=act,
             timestamps={'start': time.time()}))
     elif Type in ['stream']:
         await self.bot.change_presence(activity=nextcord.Activity(
             type=nextcord.ActivityType.streaming,
             name=act,
             timestamps={'start': time.time()}))
     else:
         return await ctx.send(
             "Sélectionnez *play*, *watch*, *listen* ou *stream* suivi du nom"
         )
     await ctx.message.delete()
Ejemplo n.º 2
0
def main():
    # allows privledged intents for monitoring members joining, roles editing, and role assignments
    intents = nextcord.Intents.default()
    intents.guilds = True
    intents.members = True
    intents.message_content = True

    activity = nextcord.Activity(type=nextcord.ActivityType.listening,
                                 name=f"{config.PREFIX}help")

    bot = commands.Bot(
        command_prefix=commands.when_mentioned_or(config.PREFIX),
        intents=intents,
        activity=activity,
        owner_id=config.OWNER_ID,
    )

    # boolean that will be set to true when views are added
    bot.persistent_views_added = False

    @bot.event
    async def on_ready():
        print(f"{bot.user.name} has connected to Discord.")

    # load all cogs
    for folder in os.listdir("cogs"):
        bot.load_extension(f"cogs.{folder}")

    async def startup():
        bot.session = aiohttp.ClientSession()

    bot.loop.create_task(startup())

    # run the bot
    bot.run(config.BOT_TOKEN)
 def __init__(self, bot: commands.Bot):
     self.__bot = bot
     self.status_list = (
         nextcord.Activity(type=nextcord.ActivityType.watching,
                           name="you struggle 👀"),
         nextcord.Game(name="around with numbers‍"),
     )
     self.current_status = random.randint(0, len(self.status_list) - 1)
Ejemplo n.º 4
0
async def on_ready():
	f.log('ready!')

	await bot.change_presence(status=tt.presence.default[1], activity=nextcord.Activity(type=tt.presence.default[2],name=tt.presence.default[0]))
	tt.e.upvote = bot.get_emoji(tt.e.upvote)
	tt.e.downvote = bot.get_emoji(tt.e.downvote)
	if not tt.testing:
		tt.misc.update_one({'_id':'misc'}, {"$set":{"guilds":[guild.id for guild in bot.guilds]}}, upsert=True)

	print(f"\n  ___/-\___    Online\n |---------|   {bot.user.name}#{bot.user.discriminator} ({bot.user.id})\n  | | | | |  _                 _     _           _   \n  | | | | | | |_ _ __ __ _ ___| |__ | |__   ___ | |_ \n  | | | | | | __| '__/ _` / __| '_ \| '_ \ / _ \| __|\n  | | | | | | |_| | | (_| \__ \ | | | |_) | (_) | |_ \n  |_______|  \__|_|  \__,_|___/_| |_|_.__/ \___/ \__|\n")
Ejemplo n.º 5
0
    def get_presence(self) -> Tuple[nextcord.Status, nextcord.Activity]:
        activity_type = self.settings.get('game.type').lower()
        activity_name = self.settings.get('game.name')
        status = self.settings.get('status')

        return (
            nextcord.Status[status],
            nextcord.Activity(
                name=activity_name, type=nextcord.ActivityType[activity_type]
            ),
        )
Ejemplo n.º 6
0
 async def presence(self, ctx, *, presence: str):
     x = tt.presence.default
     for y, z in enumerate(presence.split(';')):
         x[y] = z
     if x[1] not in tt.presence.status or x[2] not in tt.presence.activity:
         await ctx.send(
             tt.x +
             f"invalid format! (text;{'/'.join(tt.presence.status)};{'/'.join(tt.presence.activity)})"
         )
         return
     await self.bot.change_presence(status=tt.presence.status[x[1]],
                                    activity=nextcord.Activity(
                                        type=tt.presence.activity[x[2]],
                                        name=x[0]))
     f.log(f"{ctx.author} set presence to {x[1]}, {x[2]} '{x[0]}'")
     await ctx.message.add_reaction(tt.e.check)
Ejemplo n.º 7
0
async def on_ready():
    await disclient.change_presence(activity=discord.Activity(
        type=discord.ActivityType.watching, name=f"for {default_prefix}help"),
                                    status=discord.Status.online)
    print(
        f"bot is online as {disclient.user.name} in {len(disclient.guilds)} guilds!:"
    )
    for guild in disclient.guilds:
        # add if guild id not in guild table here...
        added = add_guild_db(guild.id)
        if added:
            print(
                f'Added {guild.name} with {guild.member_count} members to the database!\n(ID: {guild.id})'
            )
        else:
            print(
                f'{guild.name}: Member Count: {guild.member_count}\n(ID: {guild.id})'
            )

    await disclient.loop.create_task(write_cache())
Ejemplo n.º 8
0
 async def activity(self, ctx: commands.Context):
     activities = {'playing': nextcord.ActivityType.playing, 'streaming': nextcord.ActivityType.streaming,
                   'listening': nextcord.ActivityType.listening, 'watching': nextcord.ActivityType.watching,
                   'competing': nextcord.ActivityType.competing}
     if ctx.message.author.id in self.bot_masters:
         arguments = ctx.message.content.split(" ")
         if arguments[1].lower() in activities.keys():
             activity_type = activities[arguments[1].lower()]
             activity_name = " ".join(arguments[2:])
             try:
                 await self.bot.change_presence(activity=nextcord.Activity(name=activity_name, type=activity_type))
             except Exception as e:
                 await ctx.send(self.error_emoji)
                 self.logger.error(e)
             else:
                 await ctx.send(self.success_emoji)
         else:
             await ctx.send("Invalid Activity Type: " + arguments[1] + "\n" + "Valid Types: " + str(activities.keys()))
     else:
         await ctx.send(self.error_emoji + " You do not have permission to use this command.")
Ejemplo n.º 9
0
    async def setpresence(
        self,
        ctx: commands.Context,
        presence_type: Required("watching", "listening",
                                "playing"),  # type:ignore
        *,
        name: str,
    ) -> None:
        """Sets the presence of the bot. *BOT_OWNER"""

        if presence_type is False:
            return

        self.bot.settings.set('game', {'type': presence_type, 'name': name})
        await self.bot.settings.save()

        await self.bot.change_presence(activity=nextcord.Activity(
            name=name,
            type=nextcord.ActivityType[self.bot.settings.get('game.type')]))
        await ctx.send(embed=Embed(
            f"Presence is now set to {self.bot.settings.get('game.type')} {self.bot.settings.get('game.name')}."
        ))
Ejemplo n.º 10
0
async def on_ready():
    await client.change_presence(activity=nextcord.Activity(
        type=nextcord.ActivityType.listening, name=" ,help"))
    print("Kiwi is Ready")
    wishbirthday.start()
Ejemplo n.º 11
0
ytdl_format_options = {
    "cookies": "cookies.txt",
    "user_agent":
    "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0",
    "username": YT_MAIL,
    "password": YT_PASS,
    "format": "bestaudio/best",
    "outtmpl": "%(extractor)s-%(id)s-%(title)s.%(ext)s",
    "restrictfilenames": True,
    "noplaylist": True,
    "nocheckcertificate": True,
    "ignoreerrors": False,
    "logtostderr": False,
    "quiet": True,
    "no_warnings": True,
    "default_search": "auto",
    "source_address":
    "0.0.0.0"  # Bind to IPv4 since IPv6 addresses cause issues sometimes
}

# -vn discards video stream
ffmpeg_options = {"options": "-vn"}

# Bot's discord activities
activities = [
    nextcord.Game(name="with křemík."),
    nextcord.Activity(type=nextcord.ActivityType.listening,
                      name="frequencies."),
    nextcord.Activity(type=nextcord.ActivityType.watching, name="you.")
]