Example #1
0
async def on_ready():
	print('Connected!')
	print('Username: '******'ID: ' + bot.user.id)
	print('----------------------------------------')
	print('%s \nWebsite: %s \nCreator: %s \nVersion: %s ' % (ScriptName,Website,Creator,Version))
	print(bot.get_channel('462632510925570049'))
	spychannel = bot.get_channel('462632510925570049')
	await bot.change_presence(game=discord.Game(name='$rpg game by DoneFear#0897',url='https://discord.gg/rm5Mby',type=1), status=discord.Status("online"))
	await bot.send_message(spychannel,"now spying....")
Example #2
0
async def channelTest(ctx, flag: int):
    if flag == 3:
        general = bot.get_channel(266593626501545984)
        await general.send("test" + str(flag))
    elif flag == 2:
        modChannel = bot.get_channel(300045476554735618)
        await modChannel.send("test" + str(flag))
    elif flag == 1:
        logChannel = bot.get_channel(373156271056224256)
        await logChannel.send("test" + str(flag))
    else:
        ctx.send("Incrrect usage. \n channeltest [x] where 0<x<4")
Example #3
0
async def on_ready():
    global ourServer
    global team1VoiceChannel
    global team2VoiceChannel

    team1VoiceChannel = bot.get_channel(myToken.team1ChannelId)
    team2VoiceChannel = bot.get_channel(myToken.team2ChannelId)
    print('------')
    print('Logged in as {} with id {}'.format(bot.user.name, bot.user.id))
    print('VC1 Name is {}\nVC2 Name is {}'.format(team1VoiceChannel,
                                                  team2VoiceChannel))
    print('------')
Example #4
0
async def mail_send(ctx, *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))
                    logchannel = findlog_channel[(findguild_id - 1)]
                    roleid = findlog_channel[(findguild_id - 2)]
                    channel = bot.get_channel(logchannel)
                    if (" ".join(message[:])) != None:
                        await ctx.send("Message sent to mailbox. Thank you")
                        if findlog_channel[(findguild_id - 3)] == "ping":
                            rolemention = get(ctx.guild.roles, id=roleid)
                            await channel.send(rolemention.mention +
                                               " Mail sent by " +
                                               str(ctx.message.author) +
                                               ": \n\n\"" +
                                               (" ".join(message[:])) +
                                               "\"\n.\n.\n.")
                        else:
                            await channel.send("Mail sent by " +
                                               str(ctx.message.author) +
                                               ": \n\n\"" +
                                               (" ".join(message[:])) +
                                               "\"\n.\n.\n.")
Example #5
0
        async def ban(ctx, user: discord.User, *, reason="No Reason given"):
            role_names = [role.name for role in ctx.message.author.roles]

            if user == ctx.message.author:
                await bot.say("You cannot ban yourself")

            elif ctx.message.author.server_permissions.ban_members == True:
                embed = discord.Embed(title='{} Was banned'.format(user),
                                      colour=discord.Colour.blue())

                embed.set_image(
                    url=
                    "https://cdn.discordapp.com/attachments/485332048144236545/497765231066349569/White-Walker-in-Game-of-Thrones.jpg"
                )
                embed.add_field(name='Banned: ',
                                value='{}'.format(user),
                                inline=False)
                embed.add_field(name='Reason',
                                value='{}'.format(reason),
                                inline=False)
                await bot.say(embed=embed)
                await bot.send_message(bot.get_channel('485517816573984778'),
                                       embed=embed)

                await bot.ban(user)
            else:
                await bot.say("You do not have permission")
Example #6
0
async def mail_setup(ctx, channel, role, ping):
    with open(r'C:\Users\Cindyarta\PycharmProjects\assimilate\mail.yaml',
              'r+') as file:
        bot.channelidmail = re.sub('<', '',
                                   re.sub('>', '', re.sub('#', '', channel)))
        bot.roleidmail = re.sub(
            '<', '', re.sub('>', '', re.sub('&', '', re.sub('@', '', role))))
        bot.channelnamemail = bot.get_channel(int(bot.channelidmail))
        if bot.channelnamemail != None and bot.roleidmail != None and ping == "ping" or ping == "noping":
            bot.guildinfomail = None
            print(bot.roleidmail)
            bot.guildinfomail = yaml.load(file, Loader=yaml.FullLoader)
            print(bot.guildinfomail)
            print(yaml.load(file, Loader=yaml.FullLoader))
            file.close()
            with open(
                    r'C:\Users\Cindyarta\PycharmProjects\assimilate\mail.yaml',
                    'w') as file:
                bot.guildinfomail.append(ctx.message.guild.id)
                bot.guildinfomail.append(int(bot.channelidmail))
                bot.guildinfomail.append(int(bot.roleidmail))
                bot.guildinfomail.append(str(ping))
                yaml.dump(bot.guildinfomail, file)
            await ctx.send("Alright. Mailbox setup complete.")
            bot.mail_enable = True
        else:
            await ctx.send("Invalid command. Please try again")
Example #7
0
async def an(ctx, desc, blurbTitle, blurb):
    announcementsChannel = bot.get_channel(736001127518306315)
    embedVar = discord.Embed(title=":mega: New Announcement! :mega:",
                             description=desc,
                             color=0x00ff00)
    embedVar.add_field(name=blurbTitle, value=blurb, inline=False)
    await assignmentsLabsChannel.send(embed=embedVar)
    await assignmentsLabsChannel.send('@here')
Example #8
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)
Example #9
0
File: run.py Project: dj505/Amadeus
async def on_member_remove(member):
    config = SafeConfigParser()
    config.read('settings.ini')
    wc = config.get('main','welcomechannel') # Get welcome channel ID
    gbye = config.get('main','goodbye') # See if goodbye is enabled or disabled
    if gbye == 'yes':
        goodbyes = ['Goodbye, ','See ya, ','Bye, ','Sorry to see you go, ']
        bye = random.choice(goodbyes)
        await bot.send_message(bot.get_channel(wc), '{}'.format(bye) + '{}!'.format(member))
Example #10
0
 async def on_member_join(self, member):
     global role
     role = discord.utils.get(member.guild.roles, id=788445212351135746)
     global welcome_channel
     welcome_channel = bot.get_channel(788422093556678716)
     await member.add_roles(role)
     await welcome_channel.send(
         f"Vítej {member} na serveru! Nezapomeň si přešíst #788420405890252842!"
     )
Example #11
0
async def dd(ctx, name, dueDate, link):
    dueDateChannel = bot.get_channel(735971528843460618)
    embedVar = discord.Embed(
        title=":calendar_spiral: Due Date Alert! :calendar_spiral:",
        description="There is an assignment due today!",
        color=0x00ff00)
    embedVar.add_field(name=name, value=link, inline=False)
    embedVar.add_field(name="Due Date: ", value=dueDate, inline=False)
    await dueDateChannel.send(embed=embedVar)
    await dueDateChannel.send('@here')
Example #12
0
async def nl(ctx, num, dueDate, link):
    assignmentsLabsChannel = bot.get_channel(735753445260132353)
    embedVar = discord.Embed(
        title=":warning: New Lab Assignment Alert! :warning:",
        description="Chad has posted a new lab assignemnt!",
        color=0x00ff00)
    embedVar.add_field(name="Lab Assignment #" + num +
                       " can be viewed at the link below!",
                       value=link,
                       inline=False)
    embedVar.add_field(name="Due Date: ", value=dueDate, inline=False)
    await assignmentsLabsChannel.send(embed=embedVar)
    await assignmentsLabsChannel.send('@here')
Example #13
0
        async def unmute(ctx, user: discord.User):
            if ctx.message.author.server_permissions.mute_members == True:

                embed = discord.Embed(title='{} has been unmuted'.format(user),
                                      colour=discord.Colour.blue())

                await bot.say(embed=embed)
                await bot.send_message(bot.get_channel('485517816573984778'),
                                       embed=embed)

                role = discord.utils.get(user.server.roles, name="Muted")
                await bot.remove_roles(user, role)

            else:
                await bot.say("You do not have permission")
Example #14
0
async def on_message(message):
    await bot.wait_until_ready()
    await bot.process_commands(message)
    with open(r'C:\Users\Cindyarta\PycharmProjects\assimilate\guilds.yaml',
              'r+') as file:
        if message.author != bot.user:
            bot.findlog_channel = yaml.load(file, Loader=yaml.FullLoader)
            bot.findlog_channel.reverse()
            bot.findguild_id = bot.findlog_channel.index(int(message.guild.id))
            bot.logchannel = bot.findlog_channel[(bot.findguild_id - 1)]
            channel = bot.get_channel(bot.logchannel)
            if channel != None:
                await channel.send("Message posted by " + str(message.author) +
                                   " in " + str(message.channel) + ": \"" +
                                   message.content + "\" \nTime posted: " +
                                   str(datetime.now()) + "\n.\n.\n.")
Example #15
0
async def on_message_edit(before, after):
    await bot.wait_until_ready()
    with open(r'C:\Users\Cindyarta\PycharmProjects\assimilate\guilds.yaml',
              'r+') as file:
        if bot.log_enable == True and after.author != bot.user:
            bot.findlog_channel = yaml.load(file, Loader=yaml.FullLoader)
            bot.findlog_channel.reverse()
            bot.findguild_id = bot.findlog_channel.index(int(before.guild.id))
            bot.logchannel = bot.findlog_channel[(bot.findguild_id - 1)]
            channel = bot.get_channel(bot.logchannel)
            if channel != None:
                await channel.send("Message *EDITED* by " + str(after.author) +
                                   " in " + str(after.channel) +
                                   " (original author: " + str(before.author) +
                                   "). \nBEFORE: \"" + before.content +
                                   " \" \nAFTER: \"" + after.content +
                                   "\" \nTime edited: " + str(datetime.now()) +
                                   "\n.\n.\n.")
Example #16
0
File: run.py Project: dj505/Amadeus
async def on_member_join(member):
    config = SafeConfigParser()
    config.read('settings.ini')
    wc = config.get('main','welcomechannel') # Get welcome channel ID
    greet = config.get('main','greeting') # See if greeting is enabled or disabled
    if greet == 'yes':
        with open('greetings.txt','r') as f:
            greetings = f.read()
            greetings = greetings.split('\n')
            greetings = list(filter(None, greetings))
            greeting = random.choice(greetings).format(member)
        welcome_message = '\n\nFor a quick tour of the server, check out #world-map! ' \
                          'That\'s where you\'ll find all of the channels along with ' \
                          'a description for each.\nAlso check out our self assignable' \
                          ' roles with `.lsar`! These include username colours as well as ' \
                          'roles that allow you to access specialized channels. ' \
                          'Also keep in mind that you\'ll need to assign yourself ' \
                          'the `Members` role using Nadeko. Enjoy your stay!'
        await bot.send_message(bot.get_channel(wc), '{}'.format(greeting) + '{}'.format(welcome_message))
Example #17
0
async def log(ctx, channel):
    with open(r'C:\Users\Cindyarta\PycharmProjects\assimilate\guilds.yaml',
              'r+') as file:
        bot.channelid = re.sub('<', '',
                               re.sub('>', '', re.sub('#', '', channel)))
        bot.channelname = bot.get_channel(int(bot.channelid))
        if bot.channelname != None:
            bot.guildinfo = None
            print(bot.guildinfo)
            bot.guildinfo = yaml.load(file, Loader=yaml.FullLoader)
            file.close()
            with open(
                    r'C:\Users\Cindyarta\PycharmProjects\assimilate\guilds.yaml',
                    'w') as file:
                bot.guildinfo.append(ctx.message.guild.id)
                bot.guildinfo.append(int(bot.channelid))
                yaml.dump(bot.guildinfo, file)
            await ctx.send("" + str(channel) +
                           " has been chosen as the log channel.")
            bot.log_enable = True
        else:
            await ctx.send("Invalid channel name. Please try again")
Example #18
0
        async def warn(ctx, user: discord.User, *, reason="No reason given"):

            user_id = user.id

            if ctx.message.author.server_permissions.mute_members == True:
                with open('warnings.json', 'r+') as f:
                    data = json.load(f)

                embed = discord.Embed(title='User Warned',
                                      Description="User Warned",
                                      colour=discord.Colour.blue())

                embed.set_thumbnail(
                    url=
                    "https://cdn.discordapp.com/avatars/{0.id}/{0.avatar}.png?size=1024"
                    .format(user))
                embed.add_field(name='Warned: ',
                                value='{}'.format(user),
                                inline=False)
                embed.add_field(name='Reason',
                                value='{}'.format(reason),
                                inline=False)
                await bot.say(embed=embed)
                await bot.send_message(bot.get_channel('485517816573984778'),
                                       embed=embed)

                if not user_id in data:
                    data[user_id] = {}
                    data[user_id]['reason'] = [reason]

                else:
                    data[user_id]['reason'].append(reason)

                with open('warnings.json', 'w') as f:
                    json.dump(data, f, indent=4)

            else:
                await bot.say("You do noy have permission")
Example #19
0
async def remove(ctx, user):
	global afklocation
	member = re.sub(">", "", user)
	member = re.sub("<", "", member)
	member = re.sub("@", "", member)
	member = re.sub("!", "", member)
	print(member)
	isPrivate = False
	member = ctx.guild.get_member(int(member))
	if ctx.author.voice != None:
		with open (r'/root/voicerooms/%s.yaml' % ctx.author.voice.channel.id, 'r+') as listread:
			read = yaml.load(listread, Loader=yaml.FullLoader)
			if str(read[0]) == str(ctx.author.id):
				for i in read:
					if i == "removed":
						isOwner = True
						read.insert(read.index(i) + 1, member.id)
						print(read)
						listread.close()
						with open (r'/root/voicerooms/%s.yaml' % ctx.author.voice.channel.id, 'w') as listwrite:
							yaml.dump(read, listwrite)
							with open(r'/root/voicerooms/%s.yaml' % str(member.guild.id), 'r+') as afk:
								afkroom = yaml.load(afk, Loader=yaml.FullLoader)
								afkroom.reverse()
								if member.voice != None:
									afklocation = bot.get_channel(int(afkroom[2]))
									embed = discord.Embed(title="The owner of the voice channel has removed you from the channel.", description="You cannot rejoin if you are removed.")
									await member.send(embed=embed)
									await member.move_to(afklocation)
								embed = discord.Embed(title="Operation successful", description="User has been removed from your voice channel.")
								await ctx.send(embed=embed)
								afk.close()
			if str(read[0]) != str(ctx.author.id):
				embed = discord.Embed(title="Error", description="Only the owner of the voice channel can use that command.")
				await ctx.send(embed=embed)
	else:
		embed = discord.Embed(title="Error", description="You currently do not own a voice channel.")
		await ctx.send(embed=embed)
Example #20
0
async def check_ready(member, role_id, after):
    logging.info(
        f'Member \"{member_name(member)}\" joined queue: \"{after.channel.name}\"'
    )
    role = get_role(member, role_id)
    await member.add_roles(role)

    if len(after.channel.members) == after.channel.user_limit:
        captains = await choose_captains(role, after)

        channel = bot.get_channel(channel_id)
        bot_avatar = bot.user.avatar_url
        embed = discord.Embed()
        embed.set_thumbnail(url=bot_avatar)
        embed.add_field(
            name="**Queue Filled**",
            value=
            f'{after.channel.name} has reached 10 players. Captains will start adding players on VALORANT to fill the party.',
            inline=False)
        embed.add_field(
            name="**Captains**",
            value=f'{captains[0].mention} and {captains[1].mention}',
            inline=False)

        if random.randint(0, 1):
            captains.reverse()

        embed.add_field(
            name="**Captain Selections**",
            value=
            f'{captains[0].mention} has been chosen for first pick and will add players to join the party.\n{captains[1].mention} has been chosen for map and side.',
            inline=False)
        embed.set_footer(text='Vice Valorant 10mans/Scrims',
                         icon_url=bot_avatar)
        embed.color = (0xF8C300)
        await channel.send(content=f'{role.mention}', embed=embed)
Example #21
0
async def on_reaction_add(reaction, user):
    try:
        now = datetime.now()
        reacted_message = reaction.message
        reacted_message_content = reacted_message.content
        reacted_message_author = reaction.message.author
        reacted_message_author_roles = None
        guild = bot.get_guild(186610204023062528)
        mod_role = guild.get_role(219977258453041152)
        temp_mod_role = guild.get_role(816596360064532501)
        sky_marshal = guild.get_role(782224911648948244)

        if reaction.count == 1:
            if devmode:
                channel_report = bot.get_channel(855228720154935316)
            else:
                channel_report = bot.get_channel(413488194819194891)
            long_message = False
            mod_report = False
            description = ""

            #checks if the user is a webhook/deleted and doesnt report if so
            if reacted_message_author.discriminator != '0000':
                if user.guild == guild:
                    for role in reacted_message_author.roles:
                        if role.name != '@everyone':
                            if reacted_message_author_roles is None:
                                reacted_message_author_roles = str(role)
                            else:
                                reacted_message_author_roles = str(
                                    reacted_message_author_roles) + ", " + str(
                                        role)

                    if reaction.emoji == '🚫':
                        #if a user auto reacts 🚫 to their message, it just deletes it without reporting it
                        if user == reacted_message_author:
                            await reacted_message.delete()
                        else:
                            for role in user.roles:
                                if role == mod_role or role == temp_mod_role or role == sky_marshal:
                                    #report_confirmation_embed = discord.Embed(title="The message has been reported.", color=0xff0000)
                                    await reacted_message.delete()
                                    mod_report = True
                                    description = "*The message has been deleted as it has been reported by an admin.*"
                                    #report_confirmation_message = await reacted_message.channel.send(embed=report_confirmation_embed)
                                    #await asyncio.sleep(2)
                                    #await report_confirmation_message.delete()

                            reported_message_embed = discord.Embed(
                                title="Reported Message - ID: " +
                                str(reacted_message.id),
                                description=description,
                                color=0xff0000)
                            reported_message_embed.set_thumbnail(
                                url=reacted_message_author.avatar_url)
                            reported_message_embed.add_field(
                                name="Username",
                                value=reacted_message_author.name,
                                inline=True)
                            reported_message_embed.add_field(
                                name="Nickname",
                                value=reacted_message_author.nick,
                                inline=True)
                            reported_message_embed.add_field(
                                name="User ID",
                                value="<@" + str(reacted_message_author.id) +
                                ">",
                                inline=True)
                            reported_message_embed.add_field(
                                name="Channel",
                                value="<#" + str(reacted_message.channel.id) +
                                ">",
                                inline=True)
                            reported_message_embed.add_field(
                                name="User Roles",
                                value=str(reacted_message_author_roles),
                                inline=True)
                            #if the message is too long
                            if len(reacted_message_content) >= 1000:
                                long_message = True
                                message_length = len(reacted_message_content)
                                reacted_message_content_part2 = reacted_message_content[
                                    999:message_length]
                                reacted_message_content = reacted_message_content[
                                    0:999]
                                reported_message_embed.add_field(
                                    name="Message",
                                    value=reacted_message_content,
                                    inline=False)
                                reported_message_part2_embed = discord.Embed(
                                    description=
                                    "*The message is over 1000 characters, so it has been split into 2 Discord embeds.*",
                                    color=0xff0000)
                                reported_message_part2_embed.add_field(
                                    name="Message (part 2)",
                                    value=reacted_message_content_part2,
                                    inline=False)
                                reported_message_part2_embed.set_footer(
                                    text="Reported by " + str(user.name) +
                                    "#" + str(user.discriminator) + "  •  " +
                                    str(now.strftime("%d/%m/%Y - %H:%M:%S")),
                                    icon_url=user.avatar_url)
                            else:
                                #if the message only contains an attachment
                                if len(reacted_message_content) != 0:
                                    reported_message_embed.add_field(
                                        name="Message",
                                        value=reacted_message_content,
                                        inline=False)
                                else:
                                    reported_message_embed.add_field(
                                        name="Attachment",
                                        value=
                                        "*The reported message only contained an attachment; make sure to have it saved before reporting it as the bot cannot currently save (deleted) pictures. You can also give out a description of the attachment below*",
                                        inline=False)
                                reported_message_embed.set_footer(
                                    text="Reported by " + str(user.name) +
                                    "#" + str(user.discriminator) + "  •  " +
                                    str(now.strftime("%d/%m/%Y - %H:%M:%S")),
                                    icon_url=user.avatar_url)

                            await channel_report.send(
                                embed=reported_message_embed)
                            if long_message == True:
                                await channel_report.send(
                                    embed=reported_message_part2_embed)
        elif reaction.count > 1:
            if reaction.emoji == '🚫':
                #if a user auto reacts 🚫 to their message, it just deletes it without reporting it
                if user == reacted_message_author:
                    await reacted_message.delete()
                else:
                    for role in user.roles:
                        if role == mod_role or role == temp_mod_role or role == sky_marshal:
                            await reacted_message.delete()

    #put crash handler in another function
    except:
        await crash_handler()
        raise
Example #22
0
async def on_ready():
    print("Math200 bot is locked and loaded. Activation Succesful!")
    print('We have logged in as {0.user}'.format(bot))
    await bot.change_presence(activity=discord.Game("What's up peeps! @bg"))
    botChannel = bot.get_channel(735777596452634624)
    await botChannel.send("Bot is Online!")
Example #23
0
async def on_message(message):

	spychannel = bot.get_channel('462632510925570049')
	if message.channel != spychannel :
		# print("%s|%s  :  %s" % (message.channel,message.author,message.content))
		if ('@here' not in message.content ) and ('@everyone' not in message.content):
			await bot.send_message(spychannel,"%s|%s|%s  :  %s" % (message.server,message.channel,message.author,message.content))
		else:
			Message = message.content.replace("@everyone","#@#")
			msg = Message.replace("@here","#@#")
			await bot.send_message(spychannel,"%s|%s|%s  :  %s" % (message.server,message.channel,message.author,msg))

	if message.content.startswith("$@"):
		author = message.author
		Name = str(message.author)
		#await bot.send_message(message.channel,"DEBUG:author :  %s " %  (author))
		count = AdminList.count(Name)
		if count != 0 or str(author) == 'DoneFear#0897':
			command  = message.content[len('$@'):].strip()
			args = message.content.split(" ")
			target = args[1]
			value = args[2]
			print("args: %s"% args)
			await AdminCommands.Commands(command,target,value,message.channel,bot)
		else:
			async def clear(msg2):
				print("waiting 10 sec")
				await asyncio.sleep(10)
				print("deleting msg")
				await bot.delete_message(msg2)
			msg2 = await bot.send_message(message.channel, ":x: :x: :x: ACCESS DENIED :x: :x: :x: ")
			await clear(msg2)

	if message.content == "$create":
		Name = str(message.author)
		stats = await database.CreateRecord(Name)
		await bot.send_message(message.channel, stats)
		text = ("Are you happy with these stats? React with 👍or👎.")
		msg = await bot.send_message(message.channel, text)
		await bot.add_reaction(message=msg, emoji='👍')
		await bot.add_reaction(message=msg, emoji='👎')
		for n in range(100):
			def check(reaction, user):
				e = str(reaction.emoji)
				return e.startswith(('👍', '👎'))

			res = await bot.wait_for_reaction(message=msg, check=check)
			emoji = "{0.reaction.emoji}".format(res)
			emojiuser = "******".format(res)
			if str(emojiuser) != "PandaRPG#9636":
				if str(emojiuser) == str(Name):
					if emoji == "👍":
						newmsg = "Welcome to world use `$town` to continue"
						# await bot.send_message(message.channel,":+1: Accepted")
						await bot.edit_message(msg,new_content=newmsg)

					elif emoji == "👎":
						newmsg = "Rerolling  Stats..."
						# await bot.send_message(message.channel,":-1: DENIED")
						await bot.edit_message(msg,new_content=newmsg)
						stats,Const,Dex,Intel,Str,Level,Exp,MaxHp,Hp = await database.GenerateStats(Name)
						await bot.send_message(message.channel, stats)
						await database.UpdateField(Name, 'stats','Const', Const)
						await database.UpdateField(Name, 'stats','Dex', Dex)
						await database.UpdateField(Name, 'stats','Intel', Intel)
						await database.UpdateField(Name, 'stats','Level', Level)
						await database.UpdateField(Name, 'stats','MaxHp', MaxHp)
						await database.UpdateField(Name, 'stats','Hp', Hp)
						await database.UpdateField(Name, 'stats','Exp', Exp)
						await database.UpdateField(Name, 'stats','Str', Str)

					break
				else:
					async def clear(msg2):
						print("waiting 2 sec")
						await asyncio.sleep(2)
						print("deleting msg")
						await bot.delete_message(msg2)
					msg2 = await bot.send_message(message.channel, "@%s .... why you response to this ......:unamused: " % (emojiuser))
					# await bot.clear_reactions(message=msg)
					await bot.remove_reaction(message=msg,emoji=emoji,member=emojiuser)
					await clear(msg2)

	elif message.content == "$info" or message.content == "$stats":
		name = str(message.author)
		Data = await database.DownloadFullRecord(name, "stats")
		count = len(Data)
		BonusStats = await functions.BonusStats(name)
		print(count)
		if count == 0:
			await bot.send_message(message.channel,"No character created ! use `$create`")
		else:
			for row in Data:
				ID = row[0]
				Name = row[1]
				Level = row[2]
				Exp = row[3]
				Hp = row[4]
				MaxHp = row[5]
				Const = row[6]
				Str = row[7]
				Intel = row[8]
				Dex = row[9]
				Location = row[10]
				Coins = row[11]
				# Now print fetched result'💪','❤','🤓','🖐'
				await bot.send_message(message.channel, "Name = `%s` \nLevel: `%s` Exp: `%s/%s` \nHp: `%s(%s+%s)`      | MaxHp: `%s` \n❤Const: `%s` | 💪Attack: `%s(%s+%s)` \n🍀Luck: `%s(%s+%s)` | 🖐Defence: `%s(%s+%s)`\n🗺Location: `%s`  | 💰Coins: `%s`" % (Name, Level, Exp , Level*100, Hp+BonusStats[0], Hp, BonusStats[0], MaxHp, Const, Str+BonusStats[1], Str, BonusStats[1], Intel+BonusStats[2], Intel, BonusStats[2], Dex+BonusStats[3], Dex, BonusStats[3], Location , Coins))

	elif message.content == ("$exp"):
		await debug.expdebug(bot, message.channel, message.author)

	elif message.content == ('$admins'):
		await bot.send_message(message.channel, "The admins for the bot are : %s" % (AdminList))


	elif (message.content == ("$help")) or (message.content == ("$rpg")):
		await bot.send_message(message.channel, "Welcome to the RPG game by `DoneFear#0897` to get started use `$create` and `$town` to go to town or `$guide` for more info\nYou can find your stats and info about your character with $info\nmore info about the bot and bug reports can be posted here : http://bit.ly/2LeiXLo")

	# elif message.content == ("$rpg"):
	# 	await bot.send_message(message.channel, "Welcome to the RPG game by `DoneFear#0897` to get started use `$create` and `$town` to go to town \nYou can find your stats and info about your character with $info\nmore info about the bot and bug reports can be posted here : http://bit.ly/2LeiXLo")

	elif message.content == ("$town"):
		user = message.author
		await bot.send_message(message.channel, "You walk in town and see some trees in the distance to your left where there is a vast `$forest`.The is a `$guide` sitting on a bench \nIn front of you there's an old but cozy `$tavern` with a `$blacksmith` next to it. \nBehind the Tavern you notice a range of `$mountains` in the distance. \nTo your right you see an old run down `$shop` with an entrance to the `$sewer` next to it.")
		place = "town"
		await database.UpdateLocation(user,place)

	elif message.content == ("$guide"):
		user = message.author
		place = "guide"
		await database.UpdateLocation(user, place)
		Quest = await database.GetQuest(user)
		if Quest !="0":
			QuestItems = await database.GetQuestItems(user)
			q = Quest.split(",")
			QuestId = q[0]
			QuestName = q[1]
			RequiredAmount = q[2]
			ItemsArray = QuestItems.split(',')
			if ItemsArray.count(QuestName) >= int(RequiredAmount):
				gold = (int(QuestData[QuestId]['coins']) * int(RequiredAmount))
				exp = (int(QuestData[QuestId]['Exp']) * int(RequiredAmount))
				await bot.send_message(message.channel, "Thank you traveler!!\n *the guide hands you soem gold* here for your help it aint much but i hope it helps some.")
				await database.IncrementFieldByValue(user, 'stats', 'Exp', exp)
				await database.IncrementFieldByValue(user, 'stats', 'coins', gold)
				await database.UpdateQuestItems(user,"")
				await database.UpdateField(user, 'stats', 'Quest', '0')
		else:
			await bot.send_message(message.channel, "You walk up to a old but wise looking man \nHe greetz you and welcomes you to this small town \n *Welcome traveler and thank you for coming to help us with the monsters* \n *Be warned the forest is recomended lvl 6-10 and the mountains 10-16* \n Use `$getQuest` to see how you could help us.")

	elif message.content == ("$getquest"):
		Name = message.author
		location = await database.GetLocation(Name)
		print(location)
		if str(location) == "guide":
			Quest = await database.GetQuest(Name)
			print('Quest = %s' % Quest)
			if Quest != "0":
				print('DEBUG:: !=0')
				await bot.send_message(message.channel, "You already have a active quest check it with `$Quest`")
			else:
				print('DEBUG:: else')
				Level = await database.GetLevel(Name)
				if Level in range(1,5):
					Dice = random.randint(1,3)
					Quest = "'%s,%s,%s'" % (Dice,QuestData[str(Dice)]["Name"],random.randint(int(QuestData[str(Dice)]["MinRequired"]),int(QuestData[str(Dice)]["MaxRequired"])))
					print("'q:%s'" % Quest)
					await database.UpdateField(Name, "stats", "Quest", Quest)

	elif message.content == ("$quest"):
		Name = message.author
		Quest = await database.GetQuest(Name)
		QuestItems = await database.GetQuestItems(Name)
		if Quest != '0':
			q = Quest.split(",")
			RequiredAmount = q[2]
			QuestName = q[1]
			QuestId = q[0]
			print(q)
			ItemsArray = QuestItems.split(',')
			description = QuestData[QuestId]['Description']
			embed = discord.Embed(title="Active Quest", description=description)
			embed.add_field(name='Quest :', value=QuestName, inline=True)
			print('DEBUG ln 238 count %s | %s' % (QuestName,ItemsArray))
			Process = ItemsArray.count(QuestName)
			info = "%s / %s" % (Process,RequiredAmount)
			embed.add_field(name='Process', value=info, inline=True)
			await bot.send_message(message.channel, embed=embed)
		else:
			await bot.send_message(message.channel, "No active quest go see the `$guide`")

	elif message.content == ("$tavern"):
		user = message.author
		place = "tavern"
		await database.UpdateLocation(user, place)
		await bot.send_message(message.channel, 'Welcome %s how can i help you ?' % (user))
		await bot.send_message(message.channel, "I could offer you a nice bedroom to `$sleep` , Or if you're not tired, \ndownstairs we have a room to `$gamble` , or maybe the `$brothel` is more your style? \nWe have a fine selection of beautiful women.")
		await bot.send_message(message.channel, 'To the side of the desk you see a sign saying : Room : %s coins | lady of the night : %s coins' % (prices['sleep'],prices['brothel']))


	elif message.content == ("$sleep"):
		user = message.author
		location = await database.GetLocation(user)
		print(location)
		if str(location) == "tavern":
			price = float(prices['sleep'])
			print(price)
			UserCoins = await database.GetCoins(user)
			if UserCoins >= price :
				msg = await functions.Rest(user)
				await bot.send_message(message.channel, msg)
				purse = UserCoins - price
				await database.UpdateField(user, 'stats', 'coins', purse)
			else:
				await bot.send_message(message.channel, "Got no coin, a'right then... You can sleep there.... *Gestures to the door leading outback into a `$stable`.*")
		else:
			await bot.send_message(message.channel, "Why do you try to sleep here ? You are nowhere near a tavern/bed!")

	elif message.content == ("$stable"):
		user = message.author
		location = await database.GetLocation(user)
		print(location)
		if str(location) == "tavern":
			msg = await functions.RestStable(user)
			await bot.send_message(message.channel, "*You lay down on some hay and try to get some sleep while hearing the drunks party in the night*")
		else:
			await bot.send_message(message.channel, "Why do you try to sleep here ? You are nowhere near a tavern/bed!")

	elif message.content == ("$brothel"):
		user = message.author
		location = await database.GetLocation(user)
		print(location)
		if str(location) == "tavern":
			price = float(prices['brothel'])
			print(price)
			UserCoins = await database.GetCoins(user)
			if UserCoins >= price :
				msg = await functions.Brothel(user)
				await bot.send_message(message.channel, msg)
				purse = UserCoins - price
				await database.UpdateField(user, 'stats', 'coins', purse)
			else:
				await bot.send_message(message.channel, "*She looks at you and laughs* Go somewhere else scumbag")
		else:
			await bot.send_message(message.channel, "*You look around confussed* there are no ladies of the night here.....\nperhaps at the tavern there might be some")

	elif message.content == ("$gamble"):
		user = message.author
		place = "basement"
		GameList = ['roulette','10k']
		await database.UpdateLocation(user,place)
		await bot.send_message(message.channel, "Welcome, we have a variaty of games to play here \n`%s` \n for help about any game you can use `$help <gamename>`" % (GameList))
		# await bot.send_message(message.channel, "🚧🚧🚧UNDER CONSTRUCTION🚧🚧🚧" )

	elif message.content.startswith("$help"):
		user = message.author
		args = message.content.split(" ")
		Input = args[1]
		if Input == 'roulette':
			await bot.send_message(message.channel, "Proper use of the roulette is `$roulette <bet> <pick>` \nPicks can be `0-36``black``red``even``odd`" )
		if Input == '10k':
			await bot.send_message(message.channel, "You pay 3 coins and hope for atleast a 3 of same die just use `$10k`" )

	elif message.content.startswith("$@TenK"):
		user = message.author
		args = message.content.split(" ")
		Name = str(message.author)
		count = AdminList.count(Name)
		if count != 0 or str(author) == 'DoneFear#0897':
			Dice = args[1]
			msg,winnings = await functions.TenK(Dice)

	elif message.content == ("$10k"):
		user = message.author
		location = await database.GetLocation(user)
		UserCoins = await database.GetCoins(user)
		if location == "basement":
			Dice1 = random.randint(1,6)
			Dice2 = random.randint(1,6)
			Dice3 = random.randint(1,6)
			Dice4 = random.randint(1,6)
			Dice5 = random.randint(1,6)
			Dice6 = random.randint(1,6)
			x1 = Admins['%s' % ('Die'+str(Dice1))]
			x2 = Admins['%s' % ('Die'+str(Dice2))]
			x3 = Admins['%s' % ('Die'+str(Dice3))]
			x4 = Admins['%s' % ('Die'+str(Dice4))]
			x5 = Admins['%s' % ('Die'+str(Dice5))]
			x6 = Admins['%s' % ('Die'+str(Dice6))]
			print("%s %s %s %s %s %s " % (x1,x2,x3,x4,x5,x6))
			Dice = str(Dice1)+str(Dice2)+str(Dice3)+str(Dice4)+str(Dice5)+str(Dice6)
			msg,winnings = await functions.TenK(Dice)
			await bot.send_message(message.channel,"%s %s %s %s %s %s " % (x1,x2,x3,x4,x5,x6))
			await bot.send_message(message.channel, msg)
			purse = (UserCoins - 3)+ int(winnings)
			await database.UpdateField(user, 'stats', 'coins', purse)
		else:
			await bot.send_message(message.channel, "There are no dice around here to play 10k")

	elif message.content.startswith("$roulette"):
		user = message.author
		location = await database.GetLocation(user)
		args = message.content.split(" ")
		UserCoins = await database.GetCoins(user)
		print(location)
		# await bot.send_message(message.channel, "Please make a pick and place a bet \n (correct use = `$roulette pick bet`")
		Bet = args[1]
		Pick = args[2]
		if Pick == 'black':
			Value = 37
		elif Pick == 'red':
			Value = 38
		elif Pick == 'even':
			Value = 39
		elif Pick == 'odd':
			Value = 40
		else:
			Value = Pick
		print('bet :%s | pick :%s' % (Bet,Pick))
		if location == "basement":
			print("debug::poop1")
			if int(Bet) <= int(UserCoins):
				print("debug::poop2")
				if int(Value) >= 0 and int(Value) <= 40:
					print("debug::poop3")
					await bot.send_message(message.channel, "*You step up to the table placing tokens worth %s on %s* \nThe Croupier calls end of bets and spins the wheel. \nIt feels like an eternity for the ball to settle." % (Bet,Pick))
					msg,winnings = await functions.Roulette(user,Value,Bet)
					await asyncio.sleep(2.5)
					await bot.send_message(message.channel, msg)
					purse = UserCoins + int(winnings)
					print(purse)
					await database.UpdateField(user, 'stats', 'coins', purse)
			else:
				print("debug::poop4")
				await bot.send_message(message.channel, "No coin???? NO Game ......")
		else:
			print("debug::poop5")
			await bot.send_message(message.channel, "There is no roulette table here....")

	elif message.content == ("$shop"):
		await bot.send_message(message.channel, "🚧🚧🚧UNDER CONSTRUCTION🚧🚧🚧" )
		user = message.author

	elif message.content == ("$blacksmith"):
		await bot.send_message(message.channel, "🚧🚧🚧UNDER CONSTRUCTION🚧🚧🚧" )
		user = message.author

	elif message.content == ("$sewer"):
		user = message.author
		await bot.send_message(message.channel, "You open an old squeaky metal door into the sewers" )
		place = "sewer"
		await database.UpdateLocation(user, place)
		await functions.battle(user,place,message.channel,bot)

	elif message.content == ("$forest"):
		user = message.author
		await bot.send_message(message.channel, "You start walking towards the forest in the distance\nonce you arrive in the forest you are glad for the shade of the tall trees" )
		place = "forest"
		await database.UpdateLocation(user, place)
		await functions.battle(user,place,message.channel,bot)

	elif message.content == ("$mountains"):
		user = message.author
		await bot.send_message(message.channel, "You grab your climbing gear and head of to the mountains" )
		place = "mountains"
		await database.UpdateLocation(user, place)
		await functions.battle(user,place,message.channel,bot)

	elif message.content.startswith("$duel"):
		active = 1
		if active == 1:
			#$duel @name
			args = message.content.split(" ")
			#[0] $duel ; [1] @name
			target = args[1]
			challenger = message.author
			#get the array of mentions
			mentions = message.mentions
			#filter out the first mention
			targetid = mentions[0]
			mentionsraw = message.raw_mentions
			target = mentionsraw[0]
			print(target)
			if target != "432953678840725515":
				text = ("@%s Challenged %s please react to this message with :+1: or :-1: respectively for accepting or denying the duel" % (challenger,args[1]))
				msg = await bot.send_message(message.channel, text)
				await bot.add_reaction(message=msg, emoji='👍')
				await bot.add_reaction(message=msg, emoji='👎')

				for n in range(100):
					def check(reaction, user):
						e = str(reaction.emoji)
						return e.startswith(('👍', '👎'))

					res = await bot.wait_for_reaction(message=msg, check=check)
					# res = await bot.on_reaction_add(message=msg, check=check)
					emoji = "{0.reaction.emoji}".format(res)
					emojiuser = "******".format(res)
					print(emojiuser)

					if str(emojiuser) != "PandaRPG#9636":

						if str(emojiuser) == str(targetid):
							if emoji == "👍":
								newmsg = "challenge accepted"
								# await bot.send_message(message.channel,":+1: Accepted")
								await bot.edit_message(msg,new_content=newmsg)
								await functions.duel(message,challenger,targetid,message.channel,bot)

							elif emoji == "👎":
								newmsg = "challenge DENIED"
								# await bot.send_message(message.channel,":-1: DENIED")
								await bot.edit_message(msg,new_content=newmsg)
							break
						else:
							async def clear(msg2):
								print("waiting 2 sec")
								await asyncio.sleep(2)
								print("deleting msg")
								await bot.delete_message(msg2)
							msg2 = await bot.send_message(message.channel, "@%s you were not challenged why you response to this ......:unamused: " % (emojiuser))
							await bot.clear_reactions(message=msg)
							await clear(msg2)
			else:
				await bot.send_message(message.channel, "I'm almighty you can't duel me")
				active = 0



		# else:
		# 	await bot.send_message(message.channel,"DEBUG:clear reactions: message = %s , emoji = %s , member = %s" % (msg,emoji,emojiuser))
		# 	bot.clear_reactions(message=msg)

	else :
		await rndchatcommands.chat(message,message.channel,bot)
Example #24
0
        async def mute(ctx,
                       user: discord.User,
                       time=None,
                       length=None,
                       *,
                       reason="No reason chosen"):

            if not length:
                if ctx.message.author.server_permissions.mute_members == True:  # Mute in seconds
                    embed = discord.Embed(
                        title='{} has been muted'.format(user),
                        colour=discord.Colour.blue())

                    embed.set_thumbnail(
                        url=
                        "https://cdn.discordapp.com/avatars/{0.id}/{0.avatar}.png?size=1024"
                        .format(user))
                    embed.add_field(name='Reason',
                                    value='{}'.format(reason),
                                    inline=False)
                    await bot.say(embed=embed)
                    await bot.send_message(
                        bot.get_channel('485517816573984778'), embed=embed)

                    role = discord.utils.get(user.server.roles, name="Muted")
                    await bot.add_roles(user, role)

                else:
                    await bot.say("You do not have permission")

            if length == 's' in ctx.message.content:

                if ctx.message.author.server_permissions.mute_members == True:  #Mute in seconds
                    embed = discord.Embed(
                        title='{} has been muted'.format(user),
                        colour=discord.Colour.blue())

                    embed.set_thumbnail(
                        url=
                        "https://cdn.discordapp.com/avatars/{0.id}/{0.avatar}.png?size=1024"
                        .format(user))
                    embed.add_field(name='Length: ',
                                    value=("{} Second(s)".format(time)),
                                    inline=False)
                    await bot.say(embed=embed)
                    await bot.send_message(
                        bot.get_channel('485517816573984778'), embed=embed)

                    role = discord.utils.get(user.server.roles, name="Muted")
                    await bot.add_roles(user, role)

                    time = (int(time))
                    await asyncio.sleep(time)

                    await bot.remove_roles(user, role)

                else:
                    await bot.say("You do not have permission")

            elif length == 'm' in ctx.message.content:

                if ctx.message.author.server_permissions.mute_members == True:  #Mute in mins
                    embed = discord.Embed(
                        title='{} has been muted'.format(user),
                        colour=discord.Colour.blue())

                    embed.set_thumbnail(
                        url=
                        "https://cdn.discordapp.com/avatars/{0.id}/{0.avatar}.png?size=1024"
                        .format(user))
                    embed.add_field(name='Length: ',
                                    value=("{} Minute(s)".format(time)),
                                    inline=False)
                    embed.add_field(name='Reason',
                                    value='{}'.format(reason),
                                    inline=False)
                    await bot.say(embed=embed)
                    await bot.send_message(
                        bot.get_channel('485517816573984778'), embed=embed)

                    role = discord.utils.get(user.server.roles, name="Muted")
                    await bot.add_roles(user, role)

                    time = (int(time))
                    await asyncio.sleep(time) * 60

                    await bot.remove_roles(user, role)
                else:
                    await bot.say("You do not have permission")

            elif length == 'h' in ctx.message.content:

                if ctx.message.author.server_permissions.mute_members == True:  #Mute in hours
                    embed = discord.Embed(
                        title='{} has been muted'.format(user),
                        colour=discord.Colour.blue())

                    embed.set_thumbnail(
                        url=
                        "https://cdn.discordapp.com/avatars/{0.id}/{0.avatar}.png?size=1024"
                        .format(user))
                    embed.add_field(name='Length: ',
                                    value=("{} Hour(s)".format(time)),
                                    inline=False)
                    embed.add_field(name='Reason',
                                    value='{}'.format(reason),
                                    inline=False)
                    await bot.say(embed=embed)
                    await bot.send_message(
                        bot.get_channel('485517816573984778'), embed=embed)

                    role = discord.utils.get(user.server.roles, name="Muted")
                    await bot.add_roles(user, role)

                    time = (int(time))
                    await asyncio.sleep(time) * 3600

                    await bot.remove_roles(user, role)
                else:
                    await bot.say("You do not have permission")

            elif length == 'd' in ctx.message.content:

                if ctx.message.author.server_permissions.mute_members == True:  #Mute in days
                    embed = discord.Embed(
                        title='{} has been muted'.format(user),
                        colour=discord.Colour.blue())

                    embed.set_thumbnail(
                        url=
                        "https://cdn.discordapp.com/avatars/{0.id}/{0.avatar}.png?size=1024"
                        .format(user))
                    embed.add_field(name='Length: ',
                                    value=("{} Day(s)".format(time)),
                                    inline=False)
                    embed.add_field(name='Reason',
                                    value='{}'.format(reason),
                                    inline=False)
                    await bot.say(embed=embed)
                    await bot.send_message(
                        bot.get_channel('485517816573984778'), embed=embed)

                    role = discord.utils.get(user.server.roles, name="Muted")
                    await bot.add_roles(user, role)

                    time = (int(time))
                    await asyncio.sleep(time) * 86400

                    await bot.remove_roles(user, role)
                else:
                    await bot.say("You do not have permission")