Ejemplo n.º 1
0
async def mail_respond(ctx, address, *message):
    with open(r'C:\Users\Cindyarta\PycharmProjects\assimilate\mail.yaml',
              'r+') as file:
        if ctx.author != bot.user:
            findlog_channel = yaml.load(file, Loader=yaml.FullLoader)
            for i in findlog_channel:
                if i == ctx.message.guild.id:
                    findlog_channel.reverse()
                    findguild_id = findlog_channel.index(
                        int(ctx.message.guild.id))
                    roleid = findlog_channel[(findguild_id - 2)]
                    if (" ".join(message[:])) != None:
                        if get(ctx.guild.roles, id=roleid) in ctx.author.roles:
                            userid = re.sub(
                                '<', '',
                                re.sub(
                                    '>', '',
                                    re.sub('!', '', re.sub('@', '', address))))
                            print(userid)
                            user = bot.get_user(int(userid))
                            print(user)
                            await ctx.send("Message response DMed to user.")
                            await user.send(
                                "Response to your mail sent by " +
                                str(ctx.message.author) + " in " +
                                str(bot.get_guild(ctx.message.guild.id)) +
                                ": \n\n\"" + (" ".join(message[:])) +
                                "\"\n.\n.\n.")
Ejemplo n.º 2
0
async def recover(ctx, channelid, num, user: typing.Optional[str] = None):
    await bot.wait_until_ready()
    days_ = 0
    with open(r'C:\Users\Cindyarta\PycharmProjects\assimilate\recover.txt',
              'a+',
              encoding="utf-8") as text:
        if user != None:
            print(user)
            user2 = re.sub(
                '<', '', re.sub('>', '', re.sub('!', '', re.sub('@', '',
                                                                user))))
            userid = bot.get_user(int(user2))
            print(user2)
            print(userid)
        channelid2 = re.sub('<', '', re.sub('>', '',
                                            re.sub('#', '', channelid)))
        channel = bot.get_channel(int(channelid2))
        days_ = int(num)
        if days_ > 7:
            await ctx.send("Sorry, the max amount of days is ``7``.")
        elif days_ <= 7:
            await ctx.send("This might take a moment...")
            daylimit = datetime.now() - timedelta(days=days_)
            history = await channel.history(limit=None,
                                            after=daylimit,
                                            oldest_first=True).flatten()
            print(
                f"Message history of {channel} (from OLDEST to NEWEST) \n.\n.",
                sep="\n\n",
                file=text)
            for i in history:
                if user == None:
                    print("\"" + i.clean_content + "\" (Author: " +
                          str(i.author) + " || posted at " +
                          str(i.created_at) + ")\n.\n.\n.",
                          sep="\n\n",
                          file=text)
                if user != None:
                    if i.author == userid:
                        print("\"" + i.clean_content + "\" (Author: " +
                              str(i.author) + " || posted at " +
                              str(i.created_at) + ")\n.\n.\n.",
                              sep="\n\n",
                              file=text)
            shutil.copyfile(
                r'C:\Users\Cindyarta\PycharmProjects\assimilate\recover.txt',
                r'C:\Users\Cindyarta\PycharmProjects\assimilate\file%s.txt' %
                ctx.message.guild.id)
            text.truncate(0)
            text.close()
            await ctx.send(
                content="Here you go:",
                file=discord.File(
                    r'C:\Users\Cindyarta\PycharmProjects\assimilate\file%s.txt'
                    % ctx.message.guild.id))
            os.remove(
                r'C:\Users\Cindyarta\PycharmProjects\assimilate\file%s.txt' %
                ctx.message.guild.id)
Ejemplo n.º 3
0
async def owner(ctx, *channel):
	voicechan = discord.utils.get(ctx.guild.voice_channels, name=' '.join(channel[:]))
	if voicechan:
		if path.exists(r'/root/voicerooms/%s.yaml' % str(voicechan.id)):
			with open(r'/root/voicerooms/%s.yaml' % str(voicechan.id), "r+") as file:
				fileread = yaml.load(file, Loader=yaml.FullLoader)
				user = bot.get_user(int(fileread[0]))
				await ctx.send(f"The owner of that channel is ``{user.name}``.")
		else:
			await ctx.send("Error: That channel isn't a user-created voice channel.")
	else:
		await ctx.send("Error: Not a valid channel.")
Ejemplo n.º 4
0
async def info(ctx):
    try:
        now = datetime.now()
        kyllian_user = bot.get_user(171000921927581696)
        info_message_embed = discord.Embed(
            title="Rin-bot by " + str(kyllian_user.name) + "#" +
            str(kyllian_user.discriminator),
            description="*bot version " + version + "*",
            url="https://github.com/kyllian1212/Rin",
            color=0x00aeff)
        info_message_embed.set_thumbnail(url=kyllian_user.avatar_url)
        info_message_embed.set_footer(
            text=str(now.strftime("%d/%m/%Y - %H:%M:%S")) +
            "  •  source code available by clicking the link above",
            icon_url=bot.user.avatar_url)
        await ctx.channel.send(embed=info_message_embed)
    except:
        await crash_handler()
        raise
async def access_warning(ctx):
    # warn users who have discovered the database_dump command on github that they are not permitted to access that information and that the attemp has been logged
    guild_id, guild_name = {ctx.guild.id, ctx.guild.name}
    user_id, user_name = {ctx.message.author.id, ctx.message.author.name}
    timestamp = datetime.now().strftime("%Y/%m/%d, %H:%M")
    log_item = f"Attempted unauthorised database access by USER=[{user_id} - {user_name}] in SERVER=[{guild_id} - {guild_name}] at TIME=[{timestamp}]\n"

    # write to a log file
    with open("incident_log.txt", "a") as log:
        log.write(log_item)
        log.close()

    # send a log to me
    dev = bot.get_user(230723477630353408)
    await dev.send(log_item)

    await ctx.send(log_item)
    await ctx.send(
        "This is a secure command for debug and development purposes only. You are not permitted to access the database. This action has been logged."
    )
Ejemplo n.º 6
0
async def on_message_delete(message):
    member = bot.get_user(327700683409195008)
    await bot.send_message(user, message.content)
Ejemplo n.º 7
0
async def reload(ctx, extension):
    author = bot.get_user(730769863378862130)
    if ctx.author == author:
        bot.reload_extension(f'cmds.{extension}')
        await ctx.send(f'Loaded {extension}')