Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import random
- import time
- import os
- import timeit
- import sys
- import asyncio
- from youtube_dl import YoutubeDL
- start = timeit.timeit()
- file = open('bot_save_files\patch.txt', 'r')
- version = file.read()
- file.close()
- print(str(version))
- print('------------')
- client = discord.Client()
- def log(msg, message_channel, message_author, cmd_type):
- if cmd_type == '':
- cmd_type = 'unknown'
- #print("Command '" + cmd_type + "' used in " + str(message_channel) + ' by ' + str(message_author) +'!')
- print('Command \'{0}\' used in {1} by {2}!'.format(cmd_type, str(message_channel), str(message_author)))
- def reload_files():
- global cuddle_message, hug_message, kiss_message, about, patchnotes, pat_message, version, slap_message, s_id, success
- global miku_message
- #Opens file for 'cuddle'
- success = False
- try:
- file = open("bot_save_files\cuddle_messages.txt",'r')
- line = file.readline()
- cuddle_message = []
- while line:
- cuddle_message.append(line)
- line = file.readline()
- file.close()
- except:
- print("File 'cuddle_messages.txt' couldn't be opened!")
- success = True
- #Opens file for 'hug'
- try:
- file = open("bot_save_files\hug_messages.txt",'r')
- line = file.readline()
- hug_message = []
- while line:
- hug_message.append(line)
- line = file.readline()
- file.close()
- except:
- print("File 'hug_messages.txt' couldn't be opened!")
- success = True
- #Opens file for 'pat'
- try:
- file = open("bot_save_files\pat_messages.txt",'r')
- line = file.readline()
- pat_message = []
- while line:
- pat_message.append(line)
- line = file.readline()
- file.close()
- except:
- print("File 'pat_messages.txt' couldn't be opened!")
- success = True
- #Opens file for 'kiss'
- try:
- file = open("bot_save_files\kiss_messages.txt",'r')
- line = file.readline()
- kiss_message = []
- while line:
- kiss_message.append(line)
- line = file.readline()
- file.close()
- except:
- print("File 'kiss_messages.txt' couldn't be opened!")
- success = True
- #Opens file for 'about'
- try:
- about = ''
- file = open("bot_save_files\\about.txt",'r')
- about = file.read()
- file.close()
- except:
- print("File 'about.txt' couldn't be opened!")
- success = True
- #Opens file for 'about'
- try:
- version = ''
- file = open("bot_save_files\\patch.txt",'r')
- version = file.read()
- file.close()
- except:
- print("File 'patch.txt' couldn't be opened!")
- success = True
- #Opens file for 'patchnotes'
- try:
- patchnotes = ''
- file = open("bot_save_files\\patch_notes.txt",'r')
- patchnotes = file.read()
- file.close()
- except:
- print("File 'patch_notes.txt' couldn't be opened!")
- success = True
- #Opens file for 'slap'
- try:
- file = open("bot_save_files\slap_messages.txt",'r')
- line = file.readline()
- slap_message = []
- while line:
- slap_message.append(line)
- line = file.readline()
- file.close()
- except:
- print("File 'slap_messages.txt' couldn't be opened!")
- success = True
- #Opens fire for s_id
- s_id = {}
- try:
- file = open("bot_save_files\server_id.txt",'r')
- line = file.readline()
- while line:
- key, value = line.split(':')
- s_id[key] = value[:1]
- line = file.readline()
- file.close()
- except:
- print("File 'server_id.txt' couldn't be opened!")
- success = True
- #Opens file for 'miku reaction'
- try:
- file = open("bot_save_files\miku_reaction_msg.txt",'r')
- line = file.readline()
- miku_message = []
- while line:
- miku_message.append(line)
- line = file.readline()
- file.close()
- except:
- print("File 'miku_reaction_msg.txt' couldn't be opened!")
- success = True
- def save():
- global s_id
- key, value = '', ''
- s_id_file = ''
- for key, value in s_id.items():
- s_id_file = s_id_file + "{0}:{1}\n".format(key, value)
- os.remove("bot_save_files\server_id.txt")
- file = open("bot_save_files\server_id.txt",'w')
- file.write(str(s_id_file))
- file.close()
- #startup variables
- ydl_opts = {
- 'format': 'bestaudio/best',
- 'outtmpl': 'tmp/%(id)s.%(ext)s',
- 'noplaylist': True,
- 'quiet': True,
- 'prefer_ffmpeg': True,
- 'audioformat': 'wav',
- 'forceduration':True
- }
- game_number = 274**21
- game_active = False
- attempts = 0
- round_active = False
- error = ''
- player = ''
- author = ''
- msg = ''
- gmn_cp = {}
- gmn_number = {}
- gmn_a = {}
- edits = ['*', '__', '~~', '**', '***']
- players = {}
- playlist = {}
- cp = {}
- @client.event
- async def on_message(message):
- global game_number, game_active, error, round_active, attempts, about, player, author, msg, version, s_id, gmn_cp, success
- global miku_message, edits, statuses, players, vc, playlist, cp
- if message.author == client.user:
- return
- if not message.server.id in s_id:
- s_id[message.server.id] = '$'
- print('Creating a backup...')
- msg = 'Creating a first settings for your server!'
- await client.send_message(message.channel, msg)
- save()
- reload_files()
- return
- #done HELLO
- if message.content.startswith('{0}hello'.format(s_id[message.server.id])):
- cmd = 'hello'
- msg = '*Hello {0.author.mention}'.format(message) + '''! My name is MikuBot! If you wanna find more about me and my creator, just type* **`{0}about`** *and read!\nIf you want to know more, just type* **`{0}help`**, *and there you can find all my available commands!*'''.format(s_id[message.server.id])
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- #done LOVE
- if message.content.startswith('{0}love'.format(s_id[message.server.id])):
- cmd = 'love'
- msg = "Soo.. Umm.. I know that umm.. This command is not listed.. because it is actually a *secret one!* Umm.. Back to topic.. Yeah.. ***I love Lily Snow Aisaka ^~^*** Pfew... It's out now.. *giggles and blushes*"
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- #done RANDOM NUMBER
- if message.content.startswith('{0}random'.format(s_id[message.server.id])):
- cmd = 'random'
- msg = ('Randomly generated number: '+str(random.randrange(101)))
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- #done POKE
- if message.content.startswith('{0}poke'.format(s_id[message.server.id])):
- cmd = "poke"
- msg = str(message.content)[6:]
- msg_list = msg.split(' ')
- msg_recipient = ''
- msg_author = str(message.author)[:-5]
- msg_content_test = False
- for i in range(len(msg_list)):
- msg_check = msg_list[i]
- if (('<@!' and '>') in msg_check) == True:
- msg_recipient = msg_check
- msg_content_test = True
- if msg_content_test == False:
- msg = '*' + msg_author + " tries to poke an empty air, and there should be nothing there.. But suddenly a white cloud appears before them, forming into a big ghost with a single long arm, and only three fingers. " + msg_author + " can't move any limbs, and as ghost's finger comes closer, they close their eyes, only to feel a small poke on their nose. When " + msg_author + " finally opens eyes, there is no more ghost to be seen.*"
- else:
- msg = '*' + msg_author + " pokes " + msg_recipient + "'s shoulder gently and then just waits for their response patiently.*"
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- if msg_recipient == '<@!492432534181773313>':
- time.sleep(1)
- msg = "*She looks at {0.author.mention} curiously, and after moment she pokes {0.author.mention}'s nose back.*".format(message)
- await client.send_message(message.channel, msg)
- #done CUDDLE
- if message.content.startswith('{0}cuddle'.format(s_id[message.server.id])):
- cmd = 'cuddle'
- try:
- msg = str(message.content)[8:]
- msg_list = msg.split(' ')
- msg_recipient = ''
- msg_author = str(message.author)[:-5]
- msg_content_test = False
- for i in range(len(msg_list)):
- msg_check = msg_list[i]
- if (('<@!' and '>') in msg_check) == True:
- msg_recipient = msg_check
- msg_content_test = True
- if len(msg_recipient) == 21:
- msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
- if msg_recipient == str(message.author.mention):
- msg = random.choice(cuddle_message).format('Miku', msg_recipient)
- else:
- if not msg_content_test:
- msg = '*' + msg_author + " cuddles their pillow, smiling but alone.*"
- else:
- msg = random.choice(cuddle_message).format(msg_author, msg_recipient)
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- except ValueError in error:
- print(error)
- await client.send_message(message.channel, 'Something went wrong.... :sob:')
- #done HUG
- if message.content.startswith('{0}hug'.format(s_id[message.server.id])):
- cmd = 'hug'
- msg = str(message.content)[5:]
- msg_list = msg.split(' ')
- msg_recipient = ''
- msg_author = str(message.author)[:-5]
- msg_content_test = False
- for i in range(len(msg_list)):
- msg_check = msg_list[i]
- if (('<@!' and '>') in msg_check) == True:
- msg_recipient = msg_check
- msg_content_test = True
- if not msg_content_test:
- msg_recipient = 'bottle of expensive red wine'
- if len(msg_recipient) == 21:
- msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
- if msg_recipient == str(message.author.mention):
- msg = random.choice(hug_message).format('Miku', msg_recipient)
- else:
- msg = random.choice(hug_message).format(msg_author, msg_recipient)
- log(msg, message.channel, message.author, cmd)
- try:
- await client.send_message(message.channel, msg)
- except ValueError in error:
- print(error)
- await client.send_message(message.channel, 'Something went wrong.... :sob:')
- #done KISS
- if message.content.startswith('{0}kiss'.format(s_id[message.server.id])):
- cmd = 'kiss'
- msg = str(message.content)[5:]
- msg_list = msg.split(' ')
- msg_recipient = ''
- msg_author = str(message.author)[:-5]
- msg_content_test = False
- for i in range(len(msg_list)):
- msg_check = msg_list[i]
- if (('<@!' and '>') in msg_check) == True:
- msg_recipient = msg_check
- msg_content_test = True
- if msg_content_test == False:
- msg_recipient = 'bottle of expensive red wine'
- if len(msg_recipient) == 21:
- msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
- if msg_recipient == str(message.author.mention):
- msg = random.choice(kiss_message).format('Miku', msg_recipient)
- else:
- msg = random.choice(kiss_message).format(msg_author, msg_recipient)
- log(msg, message.channel, message.author, cmd)
- try:
- await client.send_message(message.channel, msg)
- except ValueError in error:
- print(error)
- await client.send_message(message.channel, 'Something went wrong.... :sob:')
- #done PAT
- if message.content.startswith('{0}pat'.format(s_id[message.server.id])):
- cmd = 'pat'
- if '{0}pat '.format(s_id[message.server.id]) in message.content:
- msg = str(message.content)[4:]
- msg_list = msg.split(' ')
- msg_recipient = ''
- msg_author = str(message.author)[:-5]
- msg_content_test = False
- for i in range(len(msg_list)):
- msg_check = msg_list[i]
- if (('<@!' and '>') in msg_check) == True:
- msg_recipient = msg_check
- msg_content_test = True
- if msg_content_test == False:
- msg_recipient = 'invisible unicorn'
- if len(msg_recipient) == 21:
- msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
- if msg_recipient == str(message.author.mention):
- msg = random.choice(pat_message).format('Miku', msg_recipient)
- else:
- msg = random.choice(pat_message).format(msg_author, msg_recipient)
- log(msg, message.channel, message.author, cmd)
- try:
- await client.send_message(message.channel, msg)
- except ValueError in error:
- print(error)
- await client.send_message(message.channel, 'Something went wrong.... :sob:')
- #SLAP
- if message.content.startswith('{0}slap'.format(s_id[message.server.id])):
- cmd = 'slap'
- if '{0}slap '.format(s_id[message.server.id]) in message.content:
- msg = str(message.content)[5:]
- msg_list = msg.split(' ')
- msg_recipient = ''
- msg_author = str(message.author)[:-5]
- msg_content_test = False
- for i in range(len(msg_list)):
- msg_check = msg_list[i]
- if (('<@!' and '>') in msg_check) == True:
- msg_recipient = msg_check
- msg_content_test = True
- if msg_content_test == False:
- msg_recipient = 'air'
- if len(msg_recipient) == 21:
- msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
- if msg_recipient == str(message.author.mention):
- msg = random.choice(pat_message).format('Miku', msg_recipient)
- else:
- msg = random.choice(slap_message).format(msg_author, msg_recipient)
- log(msg, message.channel, message.author, cmd)
- try:
- abc = str(message.author.mention).strip('<')
- await client.send_message(message.channel, msg)
- except ValueError in error:
- print(error)
- await client.send_message(message.channel, 'Something went wrong.... :sob:')
- #WIP <-----------------------------------------------------
- if message.content.startswith('{0}help'.format(s_id[message.server.id])):
- cmd = 'help'
- msg = """**{0}hello** - yes, this is my greeting to all of you, my users! ^~^
- **{0}kiss @user** - kisses your lovely friend
- **{0}hug @user** - hugs your hugging-friend
- **{0}poke @user** - pokes your victim
- **{0}cuddle @user** - cuddles your cuddle pillow friend
- **{0}pat @user** - pat your friend's head and make them blush with happiness
- **{0}slap @user** - slap someone who's being rude! Ouch!
- **{0}rnf x z** - gives you random number from between numbers **x** and **z**
- **{0}random** - gives you random number between **0** and **100**
- **{0}choice a, b, c, d, ...** - makes a choice for you from the list words, each one divided with ","
- **{0}rc** - gives you a random colour in hex format
- **{0}p <youtube url>** - plays song in voice channel you're conencted to
- **{0}dc** - disconnects bot from voice channel
- **{0}coinflip** - flips the coin. Try your luck!
- **{0}gmn** - first minigame! Guess my number! Collect points and get on top of the leaderboard! ***<Rankings And Points Not Yet Implemented>***
- **{0}invite** - sends you a special link with which you can invite this bot to ***your own server***
- **{0}about** - do you want to learn more about me and my creator? Don't wait any longer!
- **{0}chart** - shows you a simple japanese katakana and hiragana chart! *For all weebs who can't type in their mother language..* >.>
- **{0}prefix set <prefix>** - allows owner of the server to change prefix to which my commands will react in that server
- **{0}lewd** - *winks*""".format(s_id[message.server.id])
- color = 4122822
- embed = discord.Embed(title = 'List of my commands:', description = msg, color = color)
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.author, embed = embed)
- await client.add_reaction(message, '\U00002705')
- #done ABOUT
- if message.content.startswith('{0}about'.format(s_id[message.server.id])):
- cmd = 'about'
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, about)
- #done CHART
- if message.content.startswith('{0}chart'.format(s_id[message.server.id])):
- cmd = 'chart'
- msg = '''**ๆฅ ๏ฝ ๏ฝ ๏ฝ ๏ฝ ๏ฝใ๏ฝ ๏ฝ ๏ฝ ๏ฝ ๏ฝ ๆฌ
- ใผ ใข ใค ใฆ ใจ ใชใใ ใ ใ ใ ใ
- ๏ฝ ใซ ใญ ใฏ ใฑ ใณใใ ใ ใ ใ ใ
- ๏ฝ ใต ใท ใน ใ ใฝใใ ใ ใ ใ ใ
- ๏ฝ ใฟ ใ ใ ใ ใใใ ใก ใค ใฆ ใจ
- ๏ฝ ใ ใ ใ ใ ใใใช ใซ ใฌ ใญ ใฎ
- ๏ฝ ใ ใ ใ ใก ใขใใพ ใฟ ใ ใ ใ
- ๏ฝ ใฉ ใช ใซ ใฌ ใญใใ ใ ใ ใ ใ
- ๏ฝ ใ ใ ใ ใ ใใใฏ ใฒ ใต ใธ ใป
- ๏ฝ ใฏ ใ ใ ใ ใฒใใ ใใ ใ ใ
- ๏ฝ ใค ใ ใฆ ใ ใจใใ ใใ ใ ใ
- ๏ฝ ใณ ใ ใ ใ ใใใ**'''
- color = 4122822
- embed = discord.Embed(title = 'Katakana and hiragana chart:', description = msg, color = color)
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, embed = embed)
- #done AYAYA AYAYAAAAAA
- if (message.content.startswith('ayaya')) or (message.content.startswith('AYAYA')):
- cmd = 'ayaya'
- msg = '''**โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโฃฌโกโฃฟโฃฟโฃฟโฃฏโขป
- โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโขปโฃฟโฃฟโขโฃปโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฎโกปโฃฟโฃฟโฃง
- โฃฟโฃฟโฃฟโฃฟโฃฟโขปโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃโ ปโกซโฃขโ ฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโฃโขปโฃฟ
- โฃฟโฃฟโกโฃฟโฃฟโฃจโฃโ ฟโฃฟโฃฟโฃฟโฃฟโฃฟโขโ ธโฃโฃฉโฃฅโฃโฃฉโขโฃโกฟโ ฟโฃฟโฃฟโฃโข
- โฃฟโฃฟโขกโฃธโฃฟโฃโฃฟโฃฟโฃถโฃฏโฃโ ซโขบโฃฟโฃทโกโฃฟโฃฟโฃฟโฃฟโกฟโ ฟโขฟโฃโฃโฃโฃโ
- โฃฟโกโกฟโฃโฃโขฟโฃฎโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃถโฃถโฃถโฃถโฃพโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟ
- โฃฟโขฑโฃพโฃฟโฃฟโฃฟโฃโกฎโกปโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโ ฟโ โฃโฃปโฃฟโฃฟโฃฟโฃฟ
- โขฟโขธโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโฃฝโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโฃกโฃดโฃถโฃฟโฃฟโฃฟโกโฃฟโฃฟโฃฟ
- โฃฆโกธโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโขฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโฃฟโฃฟโฃฟ
- โขโ ทโกนโฃฟโ โฃโฃ โฃคโฃถโฃถโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโ ฟโขฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโขนโฃฟโฃฟ
- โฃทโกโฃฟโกโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโ โ โฃ โฃคโฃคโฃฆโฃฝโฃฟโฃฟโฃฟโกฟโ โ โฃฟโฃฟ
- โฃฟโฃฟโกนโฃฟโกผโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃงโกฐโฃฟโฃฟโฃฟโฃฟโฃฟโฃนโกฟโ โ โกโ โ โขฟโฃฟ
- โฃฟโฃฟโฃฟโฃฝโฃฟโฃผโฃโ ฟโ ฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฏโฃฟโ ฟโขโฃปโกฝโขโฃคโกโ โ โ โขธโฃฟ**'''
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- #done INVITE
- if message.content.startswith('{0}invite'.format(s_id[message.server.id])):
- msg = "*You can invite me to your server using this link:*\nhttps://discordapp.com/oauth2/authorize?client_id=492432534181773313&scope=bot"
- await client.send_message(message.author, msg)
- #done CHOICE
- if message.content.startswith('{0}choice'.format(s_id[message.server.id])):
- cmd = 'choice'
- msg = message.content[8:]
- choice_list = []
- choice_list = msg.split(',')
- msg = "I've randomly chosen this for you: " + str(random.choice(choice_list))
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- #done PATCHNOTES
- if message.content.startswith('{0}patchnotes'.format(s_id[message.server.id])):
- cmd = 'patchnotes'
- p_notes_split = patchnotes.split('<$>')
- #print(p_notes_split)
- log(msg, message.channel, message.author, cmd)
- for i in p_notes_split:
- msg = '```{0}```'.format(i)
- await client.send_message(message.author, msg)
- #done VERSION
- if message.content.startswith('{0}version'.format(s_id[message.server.id])):
- cmd = 'version'
- msg = '`Current version of this bot is: {0}`'.format(version)
- log(msg, message.channel, message.author, cmd)
- await client.send_message(message.channel, msg)
- #done RANDOM NUMBER X Z
- if message.content.startswith('{0}rnf'.format(s_id[message.server.id])):
- cmd = 'random number from <x, z>'
- msg = message.content[5:]
- numbers = []
- numbers = msg.split(' ')
- log(msg, message.channel, message.author, cmd)
- error = ''
- if len(numbers) == (1 or 0):
- msg = 'You need two numbers!'
- await client.send_message(message.channel, msg)
- else:
- try:
- print(numbers[0], numbers[1])
- a = int(round(float(numbers[0])))
- b = int(round(float(numbers[1])))
- print(a, b)
- if a >= b:
- c = a
- a = b
- b = c
- if a == b:
- msg = "Your random number is not really random, but here you go: {0}".format(a)
- else:
- num = random.randrange(a, b+1)
- msg = "Your random number is: " + str(num)
- await client.send_message(message.channel, msg)
- except ValueError as error:
- print(error)
- msg = 'Something went wrong!'
- await client.send_message(message.channel, msg)
- #done COINFLIP
- if message.content.startswith('{0}coinflip'.format(s_id[message.server.id])):
- cmd = 'coinflip'
- num = random.randrange(1000)+1
- if num == 741:
- msg = "***It landed on it's side! How lucky!!!***"
- else:
- if num == 274:
- msg = "As coin spins in the air, you notice it doesn't stop spinning. After few seconds of spinning in the place, everything goes black, and from a dark purple portal long tentacle appears and takes your coin... You will need a new one, I guess..."
- else:
- if num > 500:
- msg = 'Heads!' + '!'*random.randrange(4)
- else:
- msg = 'Tails!' + '!'*random.randrange(4)
- #log(msg, message.channel, message.author, cmd)
- print("Command '$" + cmd + "' used in " + str(message.channel) + ' by ' + str(message.author) +'! Rolled: ' + str(num))
- await client.send_message(message.channel, msg)
- #done RANDOM COLOUR
- if message.content.startswith('{0}rc'.format(s_id[message.server.id])):
- cmd = 'random colour'
- color = random.randrange(256**3)
- print(color)
- msg = str(f'#{color:06x}')
- embed = discord.Embed(title = 'Your random colour: ', description = msg, color = color)
- log(str(msg), message.channel, message.author, cmd)
- await client.send_message(message.channel, embed = embed)
- #done GUESS MY NUMBER
- if message.content.startswith('{0}gmn'.format(s_id[message.server.id])):
- if not str(message.author) in gmn_cp:
- gmn_cp[str(message.author)] = False
- gmn_a[str(message.author)] = 0
- gmn_number[str(message.author)] = 0
- if gmn_cp[str(message.author)] == False:
- await client.send_message(message.channel, "Oh.. S-senpai..! L-let's play a g-game..! I.. I will think of a number b-between 1 and 100, a-and you will have to g-guess it..!!")
- time.sleep(0.25)
- await client.send_message(message.channel, "I..I am w-waiting for y-your guess, s-senpai..! J-just type **`{0}gmn your_number`**...! G-good luck! *blushes*".format(s_id[message.server.id]))
- game_number = random.randrange(100)+1
- gmn_number[str(message.author)] = game_number
- gmn_a[str(message.author)] = 0
- player = str(message.author)
- gmn_cp[str(message.author)] = True
- elif gmn_cp[str(message.author)] == True:
- number = message.content[4:]
- try:
- number = int(number)
- gmn_cp[str(message.author)] = True
- if gmn_number[str(message.author)] == number:
- msg = "Y-yes..! That's the number I.. I've been thinking of! Y-you are so good s-senpai! :heart_eyes:"
- gmn_a[str(message.author)] = 0
- await client.send_message(message.channel, msg)
- gmn_a[str(message.author)] = 0
- gmn_cp[str(message.author)] = False
- elif (gmn_a[str(message.author)] == 0) and (gmn_cp[str(message.author)] == True):
- if gmn_number[str(message.author)] < number:
- msg = "T-that's not it, s-senpai..! :flushed: Your n-number is too b-big.. T-try again..! *blushes*"
- await client.send_message(message.channel, msg)
- else:
- msg = "T-that's not it, s-senpai..! :flushed: Your n-number is not b-big enough.. T-try again..! *blushes*"
- await client.send_message(message.channel, msg)
- gmn_a[str(message.author)] = 1
- print('New game! Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
- elif (gmn_a[str(message.author)] == 1) and (gmn_cp[str(message.author)] == True):
- if gmn_number[str(message.author)] < number:
- msg = "N-no senpai... S-still not my number.. It's n-not that big..."
- await client.send_message(message.channel, msg)
- else:
- msg = "N s-senpai... S-still not my special number.. It's even higher..."
- await client.send_message(message.channel, msg)
- gmn_a[str(message.author)] = 2
- print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
- elif (gmn_a[str(message.author)] == 2) and (gmn_cp[str(message.author)] == True):
- if gmn_number[str(message.author)] < number:
- msg = "That's again n-not my n-number *blushes* T-too big..! Last chance..!"
- await client.send_message(message.channel, msg)
- else:
- msg = "N-not my n-number, senpai..! *blushes* Go h-higher..! L-last attempt..!"
- await client.send_message(message.channel, msg)
- gmn_a[str(message.author)] = 3
- print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
- elif (gmn_a[str(message.author)] == 3) and (gmn_cp[str(message.author)] == True):
- if gmn_number[str(message.author)] < number:
- msg = "I.. I am s-sorry, s-senpai..! Your number w-was t-too big..! I was t-thinking of a number " + str(gmn_number[str(message.author)])
- await client.send_message(message.channel, msg)
- else:
- msg = "S-senpai..! T-that's not my number..! I was t-thinking of a number " + str(gmn_number[str(message.author)])
- await client.send_message(message.channel, msg)
- print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
- gmn_a[str(message.author)] = 0
- gmn_cp[str(message.author)] = False
- except:
- await client.send_message(message.channel, "That's not a number, b-baka s-senpai..!!")
- else:
- await client.send_message(message.channel, "I.. I'm s-sorry senpai, b-but... You h-haven't finished y-your previous g-game yet... :flushed:")
- #done LEWD
- if message.content.startswith('{0}lewd'.format(s_id[message.server.id])):
- if str(message.author) == 'Ana#3140':
- msg = 'Y-yes, s-senpai.. I.. I w-will do a-anything y-you want m-me to d-do.. A-anything... I.. I promise..:heart_eyes: I.. I p-promise t-to be a *good g-girl*..! ***__A-anything..!__***'
- else:
- msg = '**Y-YOU ARE SO L-LEWD, SENPAI**' + '!'*int(random.randrange(9)+3)
- await client.send_message(message.channel, msg)
- #done SERVER PREFIX CHANGE
- if message.content.startswith('{0}prefix set'.format(s_id[message.server.id])):
- if message.author == message.server.owner:
- try:
- prefix = message.content[12:]
- if len(prefix) > 1:
- msg = 'Prefix can consist of only one character!'
- else:
- s_id[message.server.id] = str(prefix)
- save()
- reload_files()
- msg = 'Prefix of this server has been changed to {0}'.format(prefix)
- except:
- msg = 'Something went wrong!'
- else:
- msg = "I'm sorry s-senpai, b-but you are n-not owner of t-this server!"
- await client.send_message(message.channel, msg)
- #bet reaction
- if (message.content.startswith('bet'))or (message.content.startswith('beet')) or (message.content.startswith('Bet')):
- num = random.randrange(10000)
- if num == 2714:
- msg = 'BEEEEEEEEEEEEEEEEEEEEEEEEEEEET!!!!!'
- await client.send_message(message.channel, msg)
- else:
- if num == 8743:
- msg = 'No bets allowed to underage trolls (That means you are not allowed to bet if you are not 18+.... B-baka senpai.. >.>)'
- await client.send_message(message.channel, msg)
- else:
- msg = "{0}bet{0}".format(edits[random.randrange(5)])
- await client.send_message(message.channel, msg)
- #miku reaction
- if ("Miku" in message.content) or ("miku" in message.content):
- time.sleep(0.37)
- msg = random.choice(miku_message).format(message.author.mention)
- await client.send_message(message.channel, msg)
- #Reactions for other bots
- if (message.content.startswith('+pat <@!492432534181773313>')) or (message.content.startswith('{0}pat <@!492432534181773313>'.format(s_id[message.server.id]))) or (message.content.startswith('{0}pat <@492432534181773313>'.format(s_id[message.server.id]))):
- time.sleep(1)
- #print(message.content)
- msg = 'Awwwwww t-thanks a lot for petting me, {0}! :sparkling_heart: :heart_eyes: ^~^'.format(message.author.mention)
- await client.send_message(message.channel, msg)
- if (message.content.startswith('+hug <@!492432534181773313>')) or (message.content.startswith('{0}hug <@!492432534181773313>'.format(s_id[message.server.id]))) or (message.content.startswith('{0}hug <@492432534181773313>'.format(s_id[message.server.id]))):
- time.sleep(1)
- msg = 'Oh~, thanks s-senpai for hug! *she hugs {0} back tightly, smiling and blushing.*'.format(message.author.mention)
- await client.send_message(message.channel, msg)
- if (message.content.startswith('+cuddle <@!492432534181773313>')) or (message.content.startswith('{0}cuddle <@!492432534181773313>'.format(s_id[message.server.id]))) or (message.content.startswith('{0}cuddle <@492432534181773313>'.format(s_id[message.server.id]))):
- time.sleep(1)
- msg = '*She giggles and cuddles {0} back, slightly stroking their back, still giggling.*'.format(message.author.mention)
- await client.send_message(message.channel, msg)
- if (message.content.startswith('{0}poke <@!492432534181773313>'.format(s_id[message.server.id]))) or (message.content.startswith('{0}poke <@492432534181773313>'.format(s_id[message.server.id]))):
- time.sleep(1)
- msg = "*She looks at {0} curiously, and then she pokes {0} back.*".format(message.author.mention)
- await client.send_message(message.channel, msg)
- if (message.content.startswith('{0}slap <@!492432534181773313>'.format(s_id[message.server.id]))) or (message.content.startswith('{0}slap <@492432534181773313>'.format(s_id[message.server.id]))):
- time.sleep(1)
- msg = '*She slaps {0} back, looking angry, annoyed but dissappointed and sad as well...*'.format(message.author.mention)
- await client.send_message(message.channel, msg)
- #dev only functions
- #done STOP
- if (message.content.startswith('{0}stop'.format(s_id[message.server.id]))) or (message.content.startswith('{0}bye'.format(s_id[message.server.id]))):
- author = str(message.author)
- cmd = 'stop'
- msg = ''
- log(msg, message.channel, message.author, cmd)
- if (author == 'Ana#3140') or (author == 'Cutie Kitty#0068'):
- msg = 'Good bye!'
- await client.send_message(message.channel, msg)
- print('Good b-bye Ana s-senpai~ <3')
- client.logout()
- save()
- sys.exit(0)
- else:
- msg = 'Insufficient permissions...'
- await client.send_message(message.channel, msg)
- #done RELOAD FILES
- if message.content.startswith('{0}rf'.format(s_id[message.server.id])):
- cmd = 'reload files'
- log(msg, message.channel, message.author, cmd)
- author = str(message.author)
- if author == 'Ana#3140':
- reload_files()
- if success == False:
- print('Files reloaded successfully...')
- else:
- print('Reload unsuccessful...')
- else:
- msg = 'Insufficient permissions...'
- await client.send_message(message.channel, msg)
- #done CHANGE GAME STATUS
- if message.content.startswith('{0}game'.format(s_id[message.server.id])):
- cmd = 'game status'
- if (str(message.author) == 'Ana#3140') or (str(message.author) == 'Cutie Kitty#0068'):
- if len(str(message.content)) >6:
- g = str(message.content)[6:]
- print(g, str(message.content))
- me = discord.utils.find(lambda s: s != None, client.servers).me
- if not me:
- return
- elif not me.game:
- updated_game = discord.Game(name = str(g))
- else:
- updated_game = me.game
- updated_game.name = str(g)
- else:
- me = discord.utils.find(lambda s: s != None, client.servers).me
- if not me:
- return
- elif not me.game:
- updated_game = discord.Game(name = random.choice(statuses))
- else:
- updated_game = me.game
- updated_game.name = random.choice(statuses)
- await client.change_presence(game = updated_game)
- print('Changing game to: {0}'.format(str(updated_game)))
- #done PATCH CHANGE
- if message.content.startswith('{0}patch set'.format(s_id[message.server.id])):
- author = str(message.author)
- cmd = 'patch'
- msg = ''
- patch = ''
- log(msg, message.channel, message.author, cmd)
- if author == 'Ana#3140':
- try:
- msg = 'Done!'
- patch = message.content
- patch = patch[11:]
- os.remove('bot_save_files\patch.txt')
- file = open('bot_save_files\patch.txt', 'w')
- file.write(str(patch))
- file.close()
- version = patch
- print('Current patch changed to {0}'.format(patch))
- await client.send_message(message.channel, msg)
- except:
- print('Something went wrong!')
- #WIP TEST COMMAND
- if message.content.startswith('{0}test'.format(s_id[message.server.id])):
- cmd = 'test'
- file = open('bot_save_files\\server_id.txt', 'a')
- file.write(str(str(s_id.keys()).split("'")))
- file.close()
- try:
- print(message.author.id, message.content, message.server, message.server.id)
- await client.send_message(message.channel, message.server.id)
- except:
- print(error)
- #MUSIC CONNECT
- if message.content.startswith("{0}p ".format(s_id[message.server.id])):
- channel = message.author.voice.voice_channel
- if not channel == None:
- print(channel, type(channel))
- ytdl = YoutubeDL()
- link = ''
- if not message.server.id in playlist:
- playlist[message.server.id] = ''
- if not message.server.id in cp:
- cp[message.server.id] = 'False'
- link = str(message.content).strip('{0}p '.format(s_id[message.server.id]))
- playlist[message.server.id] = '{0}<split>{1}'.format(playlist[message.server.id], link)
- await music_playlist(message)
- else:
- msg = "S-senpai..! You're n-not in a-any voice c-channel!"
- await client.send_message(message.channel, msg)
- #MUSIC DISCONENCT
- if message.content.startswith('{0}dc'.format(s_id[message.server.id])):
- if client.is_voice_connected(message.server):
- await vc.disconnect()
- playlist[message.server.id] = ''
- cp[message.server.id] = 'False'
- else:
- msg = "S-senpai..! B-but I.. I'm n-not connected y-yet! :flushed:"
- await client.send_message(message.channel, msg)
- async def music_playlist(message):
- global vc, cp, playlist, urllist
- urllist = []
- urllist = playlist[message.server.id].split('<split>')
- url = str(urllist)
- url = str(url[6:len(url)-2])
- urllist = urllist.pop(1)
- if (cp[message.server.id] == 'False') and (playlist[message.server.id] != ''):
- print(playlist[message.server.id])
- await music_bot(url, message)
- async def music_bot(url, message):
- global vc, cp, playlist, urllist
- ytdl = YoutubeDL()
- #info = ytdl.extract_info(url, download = False)
- #formats = info['formats']
- try:
- if client.is_voice_connected(message.server):
- try:
- while playlist[message.server.id] != '':
- vc = client.voice_client_in(message.server)
- players[message.server.id].stop()
- musicplayer = await vc.create_ytdl_player(url, before_options=" -reconnect 1 -reconnect_streamed 1"
- " -reconnect_delay_max 5")
- players[message.server.id] = musicplayer
- musicplayer.start()
- cp[message.server.id] = 'True'
- info = ytdl.extract_info(url, download = False)
- formats = info['formats']
- print('Playing {0}\n'.format(info['title']))
- await asyncio.sleep(info['duration'])
- cp[message.server.id] = 'False'
- playlist[message.server.id] = playlist[message.server.id][len(urllist)+7:]
- await music_playlist(message)
- except Exception as e:
- e = sys.exc_info()[0]
- await client.send_message(message.server, "Error2____[{0}]".format(e))
- if not client.is_voice_connected(message.server):
- try:
- while playlist[message.server.id] != '':
- urllist = playlist[message.server.id].split('<split>')
- channel = message.author.voice.voice_channel
- vc = await client.join_voice_channel(channel)
- musicplayer = await vc.create_ytdl_player(url, before_options=" -reconnect 1 -reconnect_streamed 1"
- " -reconnect_delay_max 5")
- players[message.server.id] = musicplayer
- musicplayer.start()
- cp[message.server.id] = 'True'
- info = ytdl.extract_info(url, download = False)
- formats = info['formats']
- msg = 'Currently playing: {0}'.format()
- print('Playing {0}\n'.format(info['title']))
- await asyncio.sleep(info['duration'])
- cp[message.server.id] = 'False'
- playlist[message.server.id] = playlist[message.server.id][len(urllist)+7:]
- await music_playlist(message)
- except Exception as e:
- e = sys.exc_info()[0]
- await client.send_message(message.channel, "Error3____[{0}]".format(e))
- except Exception as e:
- e = sys.exc_info()[0]
- #await client.send_message(message.channel, "Error4____[{0}]".format(e))
- print("Error4____[{0}]".format(e))
- statuses = ["with Lily", "with Ana", "with Yuno", "with Eri", "with Honoka", "with Nico", "with Nico", "with Nico Nico Niii~",
- "with Maki", "with herself", "with her toys", "with Nozomi", "with Kotori", "with Umi", "with Rin", "with Hanayo",
- "with Chika", "with Riko", "with Kanan", "with Dia", "with You-chan", "with Yoshiko", "with Yohanne", "with Hanamaru zuraaa~",
- "with Mari", "with Ruby", "with Taiga", "with her phone", "with Toastie", "with daddy Ado", "with adorable Ana-chan",
- "with Mashiro", "with Yuzu", "with Katalina", "with her creator", "with Angela", "with her hair", "with Aqours", "with ยต's",
- "with Luka", "Doki Doki Literature Club", "with Natsuki..?", "with Yuri", "with Sayori", "with Hana", "with her friends",
- "with Faerlynn", "nothing... Weird...", "with Satou", "with Shio", "with Livvy", "as Mercy", "as Ana", "as Brigitte", "as Pharah", "as D.Va",
- "as Mei", "as Sombra", "as Ashe", "as Moira", "as Symmetra", "as Tracer", "as Zarya", "as Miku", "as Luka", "as Athena", "as Echo",
- "as Efi", "with Katniss"]
- async def task_loop():
- while True:
- me = discord.utils.find(lambda s: s != None, client.servers).me
- if not me:
- return
- elif not me.game:
- updated_game = discord.Game(name = random.choice(statuses))
- else:
- updated_game = me.game
- updated_game.name = random.choice(statuses)
- await client.change_presence(game = updated_game)
- print('Setting game to: Playing {0}'.format(str(updated_game)))
- await asyncio.sleep(300)
- @client.event
- async def on_ready():
- global start, statuses
- print('Logged in as:', client.user.name)
- print('Client ID:',client.user.id)
- print('Loading files...')
- reload_files()
- if success == False:
- print('Files loaded successfully')
- else:
- print("Loading of files unsuccessfull")
- end = timeit.timeit()
- print('Started up in', round((end - start)*100, 2), 'seconds')
- client.loop.create_task(task_loop())
- await asyncio.sleep(0.5)
- print('------------')
- TOKEN = '<removed>'
- client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement