Advertisement
Faerlynn

Miku v0.18.8 (3.1.2019)

Jan 3rd, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 50.91 KB | None | 0 0
  1. import discord
  2. import random
  3. import time
  4. import os
  5. import timeit
  6. import sys
  7. import asyncio
  8. from youtube_dl import YoutubeDL
  9.  
  10. start = timeit.timeit()
  11.  
  12. file = open('bot_save_files\patch.txt', 'r')
  13. version = file.read()
  14. file.close()
  15. print(str(version))
  16. print('------------')
  17.  
  18. client = discord.Client()
  19.  
  20. def log(msg, message_channel, message_author, cmd_type):
  21.     if cmd_type == '':
  22.         cmd_type = 'unknown'
  23.     #print("Command '" + cmd_type + "' used in " + str(message_channel) + ' by ' + str(message_author) +'!')
  24.     print('Command \'{0}\' used in {1} by {2}!'.format(cmd_type, str(message_channel), str(message_author)))
  25.  
  26. def reload_files():
  27.     global cuddle_message, hug_message, kiss_message, about, patchnotes, pat_message, version, slap_message, s_id, success
  28.     global miku_message
  29.     #Opens file for 'cuddle'
  30.     success = False
  31.     try:
  32.         file = open("bot_save_files\cuddle_messages.txt",'r')
  33.         line = file.readline()
  34.         cuddle_message = []
  35.         while line:
  36.             cuddle_message.append(line)
  37.             line = file.readline()
  38.         file.close()
  39.     except:
  40.         print("File 'cuddle_messages.txt' couldn't be opened!")
  41.         success = True
  42.  
  43.     #Opens file for 'hug'
  44.     try:
  45.         file = open("bot_save_files\hug_messages.txt",'r')
  46.         line = file.readline()
  47.         hug_message = []
  48.         while line:
  49.             hug_message.append(line)
  50.             line = file.readline()
  51.         file.close()
  52.     except:
  53.         print("File 'hug_messages.txt' couldn't be opened!")
  54.         success = True
  55.  
  56.     #Opens file for 'pat'
  57.     try:
  58.         file = open("bot_save_files\pat_messages.txt",'r')
  59.         line = file.readline()
  60.         pat_message = []
  61.         while line:
  62.             pat_message.append(line)
  63.             line = file.readline()
  64.         file.close()
  65.     except:
  66.         print("File 'pat_messages.txt' couldn't be opened!")
  67.         success = True
  68.        
  69.     #Opens file for 'kiss'
  70.     try:
  71.         file = open("bot_save_files\kiss_messages.txt",'r')
  72.         line = file.readline()
  73.         kiss_message = []
  74.         while line:
  75.             kiss_message.append(line)
  76.             line = file.readline()
  77.         file.close()
  78.     except:
  79.         print("File 'kiss_messages.txt' couldn't be opened!")
  80.         success = True
  81.        
  82.     #Opens file for 'about'
  83.     try:
  84.         about = ''
  85.         file = open("bot_save_files\\about.txt",'r')
  86.         about = file.read()
  87.         file.close()
  88.     except:
  89.         print("File 'about.txt' couldn't be opened!")
  90.         success = True
  91.  
  92.     #Opens file for 'about'
  93.     try:
  94.         version = ''
  95.         file = open("bot_save_files\\patch.txt",'r')
  96.         version = file.read()
  97.         file.close()
  98.     except:
  99.         print("File 'patch.txt' couldn't be opened!")
  100.         success = True
  101.  
  102.     #Opens file for 'patchnotes'
  103.     try:
  104.         patchnotes = ''
  105.         file = open("bot_save_files\\patch_notes.txt",'r')
  106.         patchnotes = file.read()
  107.         file.close()
  108.     except:
  109.         print("File 'patch_notes.txt' couldn't be opened!")
  110.         success = True
  111.  
  112.     #Opens file for 'slap'
  113.     try:
  114.         file = open("bot_save_files\slap_messages.txt",'r')
  115.         line = file.readline()
  116.         slap_message = []
  117.         while line:
  118.             slap_message.append(line)
  119.             line = file.readline()
  120.         file.close()
  121.     except:
  122.         print("File 'slap_messages.txt' couldn't be opened!")
  123.         success = True
  124.  
  125.     #Opens fire for s_id
  126.     s_id = {}
  127.     try:
  128.         file = open("bot_save_files\server_id.txt",'r')
  129.         line = file.readline()
  130.         while line:
  131.             key, value = line.split(':')
  132.             s_id[key] = value[:1]
  133.             line = file.readline()
  134.         file.close()
  135.     except:
  136.         print("File 'server_id.txt' couldn't be opened!")
  137.         success = True
  138.  
  139.     #Opens file for 'miku reaction'
  140.     try:
  141.         file = open("bot_save_files\miku_reaction_msg.txt",'r')
  142.         line = file.readline()
  143.         miku_message = []
  144.         while line:
  145.             miku_message.append(line)
  146.             line = file.readline()
  147.         file.close()
  148.     except:
  149.         print("File 'miku_reaction_msg.txt' couldn't be opened!")
  150.         success = True
  151.  
  152. def save():
  153.     global s_id
  154.     key, value = '', ''
  155.     s_id_file = ''
  156.     for key, value in s_id.items():
  157.         s_id_file = s_id_file + "{0}:{1}\n".format(key, value)
  158.     os.remove("bot_save_files\server_id.txt")
  159.     file = open("bot_save_files\server_id.txt",'w')
  160.     file.write(str(s_id_file))
  161.     file.close()
  162.  
  163.  
  164. #startup variables
  165. ydl_opts = {
  166.     'format': 'bestaudio/best',
  167.     'outtmpl': 'tmp/%(id)s.%(ext)s',
  168.     'noplaylist': True,
  169.     'quiet': True,
  170.     'prefer_ffmpeg': True,
  171.     'audioformat': 'wav',
  172.     'forceduration':True
  173. }
  174.  
  175. game_number = 274**21
  176. game_active = False
  177. attempts = 0
  178. round_active = False
  179. error = ''
  180. player = ''
  181. author = ''
  182. msg = ''
  183. gmn_cp = {}
  184. gmn_number = {}
  185. gmn_a = {}
  186. edits = ['*', '__', '~~', '**', '***']
  187. players = {}
  188. playlist = {}
  189. cp = {}
  190. loop = {}
  191. lp = {}
  192. ytdl = YoutubeDL()
  193. urls = {}
  194. cpsong = {}
  195. miku_names = ['miku', 'Miku', 'M I K U', 'MIKU', 'm i k u', 'mIku', 'miKu', 'mikU', 'MIku', 'MiKu',
  196.               'MikU', 'mIKu', 'mIkU', 'mIKU', 'MiKU', 'MIkU', 'MIKu', 'miKU']
  197.  
  198.  
  199. @client.event
  200. async def on_message(message):
  201.     global game_number, game_active, error, round_active, attempts, about, player, author, msg, version, s_id, gmn_cp, success
  202.     global miku_message, edits, statuses, players, vc, playlist, cp, loop, lp, miku_names, cpsong
  203.     if message.author == client.user:
  204.         return
  205.  
  206.     if not message.server.id in s_id:
  207.         s_id[message.server.id] = '$'
  208.         print('Creating a backup...')
  209.         msg = 'Creating a first settings for your server!'
  210.         await client.send_message(message.channel, msg)
  211.         save()
  212.         reload_files()
  213.         return
  214.    
  215.     #done       HELLO
  216.     if message.content.startswith('{0}hello'.format(s_id[message.server.id])):
  217.         cmd = 'hello'
  218.         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])
  219.         log(msg, message.channel, message.author, cmd)
  220.         await client.send_message(message.channel, msg)
  221.  
  222.     #done       LOVE
  223.     if message.content.startswith('{0}love'.format(s_id[message.server.id])):
  224.         cmd = 'love'
  225.         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*"
  226.         log(msg, message.channel, message.author, cmd)
  227.         await client.send_message(message.channel, msg)
  228.  
  229.     #done       RANDOM NUMBER
  230.     if message.content.startswith('{0}random'.format(s_id[message.server.id])):
  231.         cmd = 'random'
  232.         msg = ('Randomly generated number: '+str(random.randrange(101)))
  233.         log(msg, message.channel, message.author, cmd)
  234.         await client.send_message(message.channel, msg)
  235.  
  236.     #done       POKE
  237.     if message.content.startswith('{0}poke'.format(s_id[message.server.id])):
  238.         cmd = "poke"
  239.         msg = str(message.content)[6:]
  240.         msg_list = msg.split(' ')
  241.         msg_recipient = ''
  242.         msg_author = str(message.author)[:-5]
  243.         msg_content_test = False
  244.         for i in range(len(msg_list)):
  245.             msg_check = msg_list[i]
  246.             if (('<@!' and '>') in msg_check) == True:
  247.                 msg_recipient = msg_check
  248.                 msg_content_test = True
  249.         if msg_content_test == False:
  250.             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.*"
  251.         else:
  252.             msg = '*' + msg_author + " pokes " + msg_recipient + "'s shoulder gently and then just waits for their response patiently.*"
  253.         log(msg, message.channel, message.author, cmd)
  254.         await client.send_message(message.channel, msg)
  255.         if msg_recipient == '<@!492432534181773313>':
  256.             time.sleep(1)
  257.             msg = "*She looks at {0.author.mention} curiously, and after moment she pokes {0.author.mention}'s nose back.*".format(message)
  258.             await client.send_message(message.channel, msg)
  259.  
  260.     #done       CUDDLE
  261.     if message.content.startswith('{0}cuddle'.format(s_id[message.server.id])):
  262.         cmd = 'cuddle'
  263.         try:
  264.             msg = str(message.content)[8:]
  265.             msg_list = msg.split(' ')
  266.             msg_recipient = ''
  267.             msg_author = str(message.author)[:-5]
  268.             msg_content_test = False
  269.            
  270.             for i in range(len(msg_list)):
  271.                 msg_check = msg_list[i]
  272.                 if (('<@!' and '>') in msg_check) == True:
  273.                     msg_recipient = msg_check
  274.                     msg_content_test = True
  275.             if not '!' in msg_recipient:
  276.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  277.             if msg_recipient == str(message.author.mention):
  278.                 msg = random.choice(cuddle_message).format('Miku', msg_recipient)
  279.             else:
  280.            
  281.                 if not msg_content_test:
  282.                     msg = '*' + msg_author + " cuddles their pillow, smiling but alone.*"
  283.                 else:
  284.                     msg = random.choice(cuddle_message).format(msg_author, msg_recipient)
  285.             log(msg, message.channel, message.author, cmd)
  286.        
  287.             await client.send_message(message.channel, msg)
  288.         except ValueError in error:
  289.             print(error)
  290.             await client.send_message(message.channel, 'Something went wrong.... :sob:')
  291.        
  292.  
  293.     #done       HUG
  294.     if message.content.startswith('{0}hug'.format(s_id[message.server.id])):
  295.         cmd = 'hug'
  296.         msg = str(message.content)[5:]
  297.         msg_list = msg.split(' ')
  298.         msg_recipient = ''
  299.         msg_author = str(message.author)[:-5]
  300.         msg_content_test = False
  301.         for i in range(len(msg_list)):
  302.             msg_check = msg_list[i]
  303.             if (('<@!' and '>') in msg_check) == True:
  304.                 msg_recipient = msg_check
  305.                 msg_content_test = True
  306.         if not msg_content_test:
  307.             msg_recipient = 'bottle of expensive red wine'
  308.         if not '!' in msg_recipient:
  309.             msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  310.         if msg_recipient == str(message.author.mention):
  311.             msg = random.choice(hug_message).format('Miku', msg_recipient)
  312.         else:
  313.             msg = random.choice(hug_message).format(msg_author, msg_recipient)
  314.         log(msg, message.channel, message.author, cmd)
  315.         try:
  316.             await client.send_message(message.channel, msg)
  317.         except ValueError in error:
  318.             print(error)
  319.             await client.send_message(message.channel, 'Something went wrong.... :sob:')
  320.  
  321.     #done       KISS
  322.     if message.content.startswith('{0}kiss'.format(s_id[message.server.id])):
  323.         cmd = 'kiss'
  324.         msg = str(message.content)[5:]
  325.         msg_list = msg.split(' ')
  326.         msg_recipient = ''
  327.         msg_author = str(message.author)[:-5]
  328.         msg_content_test = False
  329.         for i in range(len(msg_list)):
  330.             msg_check = msg_list[i]
  331.             if (('<@!' and '>') in msg_check) == True:
  332.                 msg_recipient = msg_check
  333.                 msg_content_test = True
  334.         if msg_content_test == False:
  335.             msg_recipient = 'bottle of expensive red wine'
  336.         if not '!' in msg_recipient:
  337.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  338.         if msg_recipient == str(message.author.mention):
  339.             msg = random.choice(kiss_message).format('Miku', msg_recipient)
  340.         else:
  341.             msg = random.choice(kiss_message).format(msg_author, msg_recipient)
  342.         log(msg, message.channel, message.author, cmd)
  343.         try:
  344.             await client.send_message(message.channel, msg)
  345.         except ValueError in error:
  346.             print(error)
  347.             await client.send_message(message.channel, 'Something went wrong.... :sob:')
  348.  
  349.     #done       PAT
  350.     if message.content.startswith('{0}pat'.format(s_id[message.server.id])):
  351.         cmd = 'pat'
  352.         if '{0}pat '.format(s_id[message.server.id]) in message.content:
  353.             msg = str(message.content)[4:]
  354.             msg_list = msg.split(' ')
  355.             msg_recipient = ''
  356.             msg_author = str(message.author)[:-5]
  357.             msg_content_test = False
  358.             for i in range(len(msg_list)):
  359.                 msg_check = msg_list[i]
  360.                 if (('<@!' and '>') in msg_check) == True:
  361.                     msg_recipient = msg_check
  362.                     msg_content_test = True
  363.             if msg_content_test == False:
  364.                 msg_recipient = 'invisible unicorn'
  365.             if not '!' in msg_recipient:
  366.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  367.             if msg_recipient == str(message.author.mention):
  368.                 msg = random.choice(pat_message).format('Miku', msg_recipient)
  369.             else:
  370.                 msg = random.choice(pat_message).format(msg_author, msg_recipient)
  371.             log(msg, message.channel, message.author, cmd)
  372.             try:        
  373.                 await client.send_message(message.channel, msg)
  374.             except ValueError in error:
  375.                 print(error)
  376.                 await client.send_message(message.channel, 'Something went wrong.... :sob:')
  377.  
  378.     #SLAP
  379.     if message.content.startswith('{0}slap'.format(s_id[message.server.id])):
  380.         cmd = 'slap'
  381.         if '{0}slap '.format(s_id[message.server.id]) in message.content:
  382.             msg = str(message.content)[5:]
  383.             msg_list = msg.split(' ')
  384.             msg_recipient = ''
  385.             msg_author = str(message.author)[:-5]
  386.             msg_content_test = False
  387.             for i in range(len(msg_list)):
  388.                 msg_check = msg_list[i]
  389.                 if (('<@!' and '>') in msg_check) == True:
  390.                     msg_recipient = msg_check
  391.                     msg_content_test = True
  392.             if msg_content_test == False:
  393.                 msg_recipient = 'air'
  394.             if not '!' in msg_recipient:
  395.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  396.             if msg_recipient == str(message.author.mention):
  397.                 msg = random.choice(pat_message).format('Miku', msg_recipient)
  398.             else:
  399.                 msg = random.choice(slap_message).format(msg_author, msg_recipient)
  400.             log(msg, message.channel, message.author, cmd)
  401.             try:
  402.                 abc = str(message.author.mention).strip('<')
  403.                 await client.send_message(message.channel, msg)
  404.                
  405.             except ValueError in error:
  406.                 print(error)
  407.                 await client.send_message(message.channel, 'Something went wrong.... :sob:')
  408.    
  409.  
  410.     #WIP               <-----------------------------------------------------
  411.     if message.content.startswith('{0}help'.format(s_id[message.server.id])):
  412.         cmd = 'help'
  413.         msg = """**{0}hello** - yes, this is my greeting to all of you, my users! ^~^
  414.        **{0}kiss @user** - kisses your lovely friend
  415.        **{0}hug @user** - hugs your hugging-friend
  416.        **{0}poke @user** - pokes your victim
  417.        **{0}cuddle @user** - cuddles your cuddle pillow friend
  418.        **{0}pat @user** - pat your friend's head and make them blush with happiness
  419.        **{0}slap @user** - slap someone who's being rude! Ouch!
  420.        **{0}rnf x z** - gives you random number from between numbers **x** and **z**
  421.        **{0}random** - gives you random number between **0** and **100**
  422.        **{0}choice a, b, c, d, ...** - makes a choice for you from the list words, each one divided with ","
  423.        **{0}rc** - gives you a random colour in hex format
  424.        **{0}p <youtube url>** - plays song in voice channel you're conencted to
  425.        **{0}dc** - disconnects bot from voice channel
  426.        **{0}coinflip** - flips the coin. Try your luck!
  427.        **{0}gmn** - first minigame! Guess my number! Collect points and get on top of the leaderboard! ***<Rankings And Points Not Yet Implemented>***
  428.        **{0}invite** - sends you a special link with which you can invite this bot to ***your own server***
  429.        **{0}about** - do you want to learn more about me and my creator? Don't wait any longer!
  430.        **{0}chart** - shows you a simple japanese katakana and hiragana chart! *For all weebs who can't type in their mother language..* >.>
  431.        **{0}prefix set <prefix>** - allows owner of the server to change prefix to which my commands will react in that server
  432.        **{0}lewd** - *winks*""".format(s_id[message.server.id])
  433.         color = 4122822
  434.         embed = discord.Embed(title = 'List of my commands:', description = msg, color = color)
  435.         log(msg, message.channel, message.author, cmd)
  436.         await client.send_message(message.author, embed = embed)
  437.         await client.add_reaction(message, '\U00002705')
  438.  
  439.     #done       ABOUT
  440.     if message.content.startswith('{0}about'.format(s_id[message.server.id])):
  441.         cmd = 'about'
  442.         log(msg, message.channel, message.author, cmd)
  443.         await client.send_message(message.channel, about)
  444.  
  445.     #done       CHART
  446.     if message.content.startswith('{0}chart'.format(s_id[message.server.id])):
  447.         cmd = 'chart'
  448.         msg = '''**日 a i u e o a i u e o 本
  449.        ー ア イ ウ エ オ あ い う え お
  450.        k カ キ ク ケ コ か き く け こ
  451.        s サ シ ス デ ソ さ し す せ そ
  452.        t タ チ ツ テ ト た ち つ て と
  453.        n ナ ニ ヌ ネ ノ な に ぬ ね の
  454.        m マ ミ ム メ モ ま み む め も
  455.        r ラ リ ル レ ロ ら り る れ ろ
  456.        h ハ ヒ フ ヘ ホ は ひ ふ へ ほ
  457.        w ワ       ヲ わ       を
  458.        y ヤ   ユ   ヨ や   ゆ   よ
  459.        n ン         ん**'''
  460.         color = 4122822
  461.         embed = discord.Embed(title = 'Katakana and hiragana chart:', description = msg, color = color)
  462.         log(msg, message.channel, message.author, cmd)
  463.         await client.send_message(message.channel, embed = embed)
  464.  
  465.     #done       AYAYA AYAYAAAAAA
  466.     if (message.content.startswith('ayaya')) or (message.content.startswith('AYAYA')):
  467.         cmd = 'ayaya'
  468.         msg = '''**⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣬⡛⣿⣿⣿⣯⢻
  469. ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⢻⣿⣿⢟⣻⣿⣿⣿⣿⣿⣿⣮⡻⣿⣿⣧
  470. ⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣆⠻⡫⣢⠿⣿⣿⣿⣿⣿⣿⣿⣷⣜⢻⣿
  471. ⣿⣿⡏⣿⣿⣨⣝⠿⣿⣿⣿⣿⣿⢕⠸⣛⣩⣥⣄⣩⢝⣛⡿⠿⣿⣿⣆⢝
  472. ⣿⣿⢡⣸⣿⣏⣿⣿⣶⣯⣙⠫⢺⣿⣷⡈⣿⣿⣿⣿⡿⠿⢿⣟⣒⣋⣙⠊
  473. ⣿⡏⡿⣛⣍⢿⣮⣿⣿⣿⣿⣿⣿⣿⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿
  474. ⣿⢱⣾⣿⣿⣿⣝⡮⡻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⣋⣻⣿⣿⣿⣿
  475. ⢿⢸⣿⣿⣿⣿⣿⣿⣷⣽⣿⣿⣿⣿⣿⣿⣿⡕⣡⣴⣶⣿⣿⣿⡟⣿⣿⣿
  476. ⣦⡸⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⣿
  477. ⢛⠷⡹⣿⠋⣉⣠⣤⣶⣶⣿⣿⣿⣿⣿⣿⡿⠿⢿⣿⣿⣿⣿⣿⣷⢹⣿⣿
  478. ⣷⡝⣿⡞⣿⣿⣿⣿⣿⣿⣿⣿⡟⠋⠁⣠⣤⣤⣦⣽⣿⣿⣿⡿⠋⠘⣿⣿
  479. ⣿⣿⡹⣿⡼⣿⣿⣿⣿⣿⣿⣿⣧⡰⣿⣿⣿⣿⣿⣹⡿⠟⠉⡀⠄⠄⢿⣿
  480. ⣿⣿⣿⣽⣿⣼⣛⠿⠿⣿⣿⣿⣿⣿⣯⣿⠿⢟⣻⡽⢚⣤⡞⠄⠄⠄⢸⣿**'''
  481.         log(msg, message.channel, message.author, cmd)
  482.         await client.send_message(message.channel, msg)
  483.  
  484.     #done       INVITE
  485.     if message.content.startswith('{0}invite'.format(s_id[message.server.id])):
  486.         msg = "*You can invite me to your server using this link:*\nhttps://discordapp.com/oauth2/authorize?client_id=492432534181773313&scope=bot"
  487.         await client.send_message(message.author, msg)
  488.  
  489.     #done       TERRARIA
  490.     if message.content.startswith('{0}terraria'.format(s_id[message.server.id])):
  491.         cmd = 'terraria'
  492.         msg = '''
  493.        **IP:** 95.105.170.188
  494.        **Port:** 6666
  495.        **Password:** *Ask Ana#3140*
  496.        *Server is hosted same way as I am.. That means it runs whenever I am online!!
  497.        Connecting to the server requires* **TModLoader**. *Our mods will get downloaded automatically when connecting!*
  498.        **List of mods:** *RecipeBrowser, WhereIsMyItem, Boss Checklist*
  499.        *You can get TModLoader here: https://tmodloader.net/*
  500.        '''
  501.         color = 4122822
  502.         embed = discord.Embed(title = 'Our Terraria server: ', description = msg, color = color)
  503.         log(msg, message.channel, message.author, cmd)
  504.         await client.send_message(message.channel, embed = embed)
  505.  
  506.     #done       CHOICE
  507.     if message.content.startswith('{0}choice'.format(s_id[message.server.id])):
  508.         cmd = 'choice'
  509.         msg = message.content[8:]
  510.         choice_list = []
  511.         choice_list = msg.split(',')
  512.         msg = "I've randomly chosen this for you: " + str(random.choice(choice_list))
  513.         log(msg, message.channel, message.author, cmd)
  514.         await client.send_message(message.channel, msg)
  515.  
  516.     #done       PATCHNOTES
  517.     if message.content.startswith('{0}patchnotes'.format(s_id[message.server.id])):
  518.         cmd = 'patchnotes'
  519.         p_notes_split = patchnotes.split('<$>')
  520.         #print(p_notes_split)
  521.         log(msg, message.channel, message.author, cmd)
  522.         for i in p_notes_split:
  523.             msg = '```{0}```'.format(i)
  524.             await client.send_message(message.author, msg)
  525.  
  526.     #done       VERSION
  527.     if message.content.startswith('{0}version'.format(s_id[message.server.id])):
  528.         cmd = 'version'
  529.         msg = '`Current version of this bot is: {0}`'.format(version)
  530.         log(msg, message.channel, message.author, cmd)
  531.         await client.send_message(message.channel, msg)
  532.  
  533.     #done       RANDOM NUMBER X Z
  534.     if message.content.startswith('{0}rnf'.format(s_id[message.server.id])):
  535.         cmd = 'random number from <x, z>'
  536.         msg = message.content[5:]
  537.         numbers = []
  538.         numbers = msg.split(' ')
  539.         log(msg, message.channel, message.author, cmd)
  540.         error = ''
  541.         if len(numbers) == (1 or 0):
  542.             msg = 'You need two numbers!'
  543.             await client.send_message(message.channel, msg)
  544.         else:
  545.             try:
  546.                 print(numbers[0], numbers[1])
  547.                 a = int(round(float(numbers[0])))
  548.                 b = int(round(float(numbers[1])))
  549.                 print(a, b)
  550.                
  551.                 if a >= b:
  552.                     c = a
  553.                     a = b
  554.                     b = c
  555.                    
  556.                 if a == b:
  557.                     msg = "Your random number is not really random, but here you go: {0}".format(a)
  558.                 else:
  559.                     num = random.randrange(a, b+1)
  560.                     msg = "Your random number is: " + str(num)
  561.                 await client.send_message(message.channel, msg)
  562.                
  563.             except ValueError as error:
  564.                 print(error)
  565.                 msg = 'Something went wrong!'
  566.                 await client.send_message(message.channel, msg)
  567.  
  568.     #done       COINFLIP
  569.     if message.content.startswith('{0}coinflip'.format(s_id[message.server.id])):
  570.         cmd = 'coinflip'
  571.         num = random.randrange(1000)+1
  572.         if num == 741:
  573.             msg = "***It landed on it's side! How lucky!!!***"
  574.         else:
  575.             if num == 274:
  576.                 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..."
  577.             else:
  578.                 if num > 500:
  579.                     msg = 'Heads!' + '!'*random.randrange(4)
  580.                 else:
  581.                     msg = 'Tails!' + '!'*random.randrange(4)
  582.         #log(msg, message.channel, message.author, cmd)
  583.         print("Command '$" + cmd + "' used in " + str(message.channel) + ' by ' + str(message.author) +'! Rolled: ' + str(num))
  584.         await client.send_message(message.channel, msg)
  585.  
  586.     #done       RANDOM COLOUR
  587.     if message.content.startswith('{0}rc'.format(s_id[message.server.id])):
  588.         cmd = 'random colour'
  589.         color = random.randrange(256**3)
  590.         print(color)
  591.         msg = str(f'#{color:06x}')
  592.         embed = discord.Embed(title = 'Your random colour: ', description = msg, color = color)
  593.         log(str(msg), message.channel, message.author, cmd)
  594.         await client.send_message(message.channel, embed = embed)
  595.  
  596.     #done       GUESS MY NUMBER
  597.     if message.content.startswith('{0}gmn'.format(s_id[message.server.id])):
  598.        
  599.         if not str(message.author) in gmn_cp:
  600.             gmn_cp[str(message.author)] = False
  601.             gmn_a[str(message.author)] = 0
  602.             gmn_number[str(message.author)] = 0
  603.            
  604.         if gmn_cp[str(message.author)] == False:
  605.             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..!!")
  606.             time.sleep(0.25)
  607.             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]))
  608.             game_number = random.randrange(100)+1
  609.             gmn_number[str(message.author)] = game_number
  610.             gmn_a[str(message.author)] = 0
  611.             player = str(message.author)
  612.             gmn_cp[str(message.author)] = True
  613.            
  614.         elif gmn_cp[str(message.author)] == True:
  615.             number = message.content[4:]
  616.             try:
  617.                 number = int(number)
  618.                 gmn_cp[str(message.author)] = True
  619.                
  620.                 if gmn_number[str(message.author)] == number:
  621.                     msg = "Y-yes..! That's the number I.. I've been thinking of! Y-you are so good s-senpai! :heart_eyes:"
  622.                     gmn_a[str(message.author)] = 0
  623.                     await client.send_message(message.channel, msg)
  624.                     gmn_a[str(message.author)] = 0
  625.                     gmn_cp[str(message.author)] = False
  626.  
  627.                    
  628.                 elif (gmn_a[str(message.author)] == 0) and (gmn_cp[str(message.author)] == True):
  629.  
  630.                     if gmn_number[str(message.author)] < number:
  631.                         msg = "T-that's not it, s-senpai..! :flushed: Your n-number is too b-big.. T-try again..! *blushes*"
  632.                         await client.send_message(message.channel, msg)
  633.                     else:
  634.                         msg = "T-that's not it, s-senpai..! :flushed: Your n-number is not b-big enough.. T-try again..! *blushes*"
  635.                         await client.send_message(message.channel, msg)
  636.  
  637.                     gmn_a[str(message.author)] = 1
  638.                     print('New game! Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  639.                    
  640.                 elif (gmn_a[str(message.author)] == 1) and (gmn_cp[str(message.author)] == True):
  641.  
  642.                    
  643.                     if gmn_number[str(message.author)] < number:
  644.                         msg = "N-no senpai... S-still not my number.. It's n-not that big..."
  645.                         await client.send_message(message.channel, msg)
  646.                     else:
  647.                         msg = "N s-senpai... S-still not my special number.. It's even higher..."
  648.                         await client.send_message(message.channel, msg)
  649.                        
  650.                     gmn_a[str(message.author)] = 2
  651.                     print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  652.  
  653.                    
  654.                 elif (gmn_a[str(message.author)] == 2) and (gmn_cp[str(message.author)] == True):
  655.                    
  656.                     if gmn_number[str(message.author)] < number:
  657.                         msg = "That's again n-not my n-number *blushes* T-too big..! Last chance..!"
  658.                         await client.send_message(message.channel, msg)
  659.                     else:
  660.                         msg = "N-not my n-number, senpai..! *blushes* Go h-higher..! L-last attempt..!"
  661.                         await client.send_message(message.channel, msg)
  662.                        
  663.                     gmn_a[str(message.author)] = 3
  664.                     print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  665.                    
  666.                 elif (gmn_a[str(message.author)] == 3) and (gmn_cp[str(message.author)] == True):
  667.                    
  668.                     if gmn_number[str(message.author)] < number:
  669.                         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)])
  670.                         await client.send_message(message.channel, msg)
  671.                     else:
  672.                         msg = "S-senpai..! T-that's not my number..! I was t-thinking of a number " + str(gmn_number[str(message.author)])
  673.                         await client.send_message(message.channel, msg)
  674.                        
  675.                     print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  676.                     gmn_a[str(message.author)] = 0
  677.                     gmn_cp[str(message.author)] = False
  678.                    
  679.             except:
  680.                 await client.send_message(message.channel, "That's not a number, b-baka s-senpai..!!")
  681.         else:
  682.             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:")
  683.  
  684.  
  685.     #done       LEWD
  686.     if message.content.startswith('{0}lewd'.format(s_id[message.server.id])):
  687.         if str(message.author) == 'Ana#3140':
  688.             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..!__***'
  689.         else:
  690.             msg = '**Y-YOU ARE SO L-LEWD, SENPAI**' + '!'*int(random.randrange(9)+3)
  691.         await client.send_message(message.channel, msg)
  692.  
  693.     #done       SERVER PREFIX CHANGE
  694.     if message.content.startswith('{0}prefix set'.format(s_id[message.server.id])):
  695.         if message.author == message.server.owner:
  696.             try:
  697.                 prefix = message.content[12:]
  698.                 if len(prefix) > 1:
  699.                     msg = 'Prefix can consist of only one character!'
  700.                 else:
  701.                     s_id[message.server.id] = str(prefix)
  702.                     save()
  703.                     reload_files()
  704.                     msg = 'Prefix of this server has been changed to {0}'.format(prefix)
  705.             except:
  706.                 msg = 'Something went wrong!'
  707.         else:
  708.             msg = "I'm sorry s-senpai, b-but you are n-not owner of t-this server!"
  709.         await client.send_message(message.channel, msg)
  710.                
  711.  
  712.     #bet reaction
  713.     if (message.content.startswith('bet'))or (message.content.startswith('beet')) or (message.content.startswith('Bet')):
  714.         num = random.randrange(10000)
  715.         if num == 2714:
  716.             msg = 'BEEEEEEEEEEEEEEEEEEEEEEEEEEEET!!!!!'
  717.             await client.send_message(message.channel, msg)
  718.         else:
  719.             if num == 8743:
  720.                 msg = 'No bets allowed to underage trolls (That means you are not allowed to bet if you are not 18+.... B-baka senpai.. >.>)'
  721.                 await client.send_message(message.channel, msg)
  722.             else:
  723.                 msg = "{0}bet{0}".format(edits[random.randrange(5)])
  724.                 await client.send_message(message.channel, msg)
  725.  
  726.     #miku reaction
  727.     #if ('miku' in message.content) or ('Miku' in message.content) or ('m i k u' in message.content) or ('M I K U' in message.content):
  728.         #print(miku_names)
  729.         #time.sleep(0.37)
  730.         #msg = random.choice(miku_message).format(message.author.mention)
  731.         #await client.send_message(message.channel, msg)
  732.     await miku_reaction(message)
  733.  
  734.     #Reactions for other bots
  735.     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]))):
  736.         time.sleep(1)
  737.         #print(message.content)
  738.         msg = 'Awwwwww t-thanks a lot for petting me, {0}! :sparkling_heart: :heart_eyes: ^~^'.format(message.author.mention)
  739.         await client.send_message(message.channel, msg)
  740.  
  741.     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]))):
  742.         time.sleep(1)
  743.         msg = 'Oh~, thanks s-senpai for hug! *she hugs {0} back tightly, smiling and blushing.*'.format(message.author.mention)
  744.         await client.send_message(message.channel, msg)
  745.  
  746.     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]))):
  747.         time.sleep(1)
  748.         msg = '*She giggles and cuddles {0} back, slightly stroking their back, still giggling.*'.format(message.author.mention)
  749.         await client.send_message(message.channel, msg)
  750.        
  751.     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]))):
  752.         time.sleep(1)
  753.         msg = "*She looks at {0} curiously, and then she pokes {0} back.*".format(message.author.mention)
  754.         await client.send_message(message.channel, msg)
  755.  
  756.     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]))):
  757.         time.sleep(1)
  758.         msg = '*She slaps {0} back, looking angry, annoyed but dissappointed and sad as well...*'.format(message.author.mention)
  759.         await client.send_message(message.channel, msg)
  760.  
  761.  
  762.     #dev only functions
  763.  
  764.     #done       STOP
  765.     if (message.content.startswith('{0}stop'.format(s_id[message.server.id]))) or (message.content.startswith('{0}bye'.format(s_id[message.server.id]))):
  766.         author = str(message.author)
  767.         cmd = 'stop'
  768.         msg = ''
  769.         log(msg, message.channel, message.author, cmd)
  770.         if (author == 'Ana#3140') or (author == 'Cutie Kitty#0068'):
  771.             msg = 'Good bye!'
  772.             await client.send_message(message.channel, msg)
  773.             print('Good b-bye Ana s-senpai~ <3')
  774.             client.logout()
  775.             save()
  776.             sys.exit(0)
  777.         else:
  778.             msg = 'Insufficient permissions...'
  779.             await client.send_message(message.channel, msg)
  780.  
  781.     #done       RELOAD FILES
  782.     if message.content.startswith('{0}rf'.format(s_id[message.server.id])):
  783.         cmd = 'reload files'
  784.         log(msg, message.channel, message.author, cmd)
  785.         author = str(message.author)
  786.         if author == 'Ana#3140':
  787.             reload_files()
  788.             if success == False:
  789.                 print('Files reloaded successfully...')
  790.             else:
  791.                 print('Reload unsuccessful...')
  792.         else:
  793.             msg = 'Insufficient permissions...'
  794.             await client.send_message(message.channel, msg)
  795.  
  796.     #done       CHANGE GAME STATUS
  797.     if message.content.startswith('{0}game'.format(s_id[message.server.id])):
  798.         cmd = 'game status'
  799.         if (str(message.author) == 'Ana#3140') or (str(message.author) == 'Cutie Kitty#0068'):
  800.             if len(str(message.content)) >6:
  801.                 g = str(message.content)[6:]
  802.                 print(g, str(message.content))
  803.                 me = discord.utils.find(lambda s: s != None, client.servers).me
  804.                 if not me:
  805.                         return
  806.                 elif not me.game:
  807.                         updated_game = discord.Game(name = str(g))
  808.                 else:
  809.                         updated_game = me.game
  810.                         updated_game.name = str(g)
  811.             else:
  812.                 me = discord.utils.find(lambda s: s != None, client.servers).me
  813.                 if not me:
  814.                         return
  815.                 elif not me.game:
  816.                         updated_game = discord.Game(name = random.choice(statuses))
  817.                 else:
  818.                         updated_game = me.game
  819.                         updated_game.name = random.choice(statuses)
  820.             await client.change_presence(game = updated_game)
  821.             print('Changing game to: {0}'.format(str(updated_game)))
  822.            
  823.  
  824.     #done       PATCH CHANGE
  825.     if message.content.startswith('{0}patch set'.format(s_id[message.server.id])):
  826.         author = str(message.author)
  827.         cmd = 'patch'
  828.         msg = ''
  829.         patch = ''
  830.         log(msg, message.channel, message.author, cmd)
  831.         if author == 'Ana#3140':
  832.             try:
  833.                 msg = 'Done!'
  834.                 patch = message.content
  835.                 patch = patch[11:]
  836.                 os.remove('bot_save_files\patch.txt')
  837.                 file = open('bot_save_files\patch.txt', 'w')
  838.                 file.write(str(patch))
  839.                 file.close()
  840.                 version = patch
  841.                 print('Current patch changed to {0}'.format(patch))
  842.                 await client.send_message(message.channel, msg)
  843.             except:
  844.                 print('Something went wrong!')
  845.            
  846.     #WIP        TEST COMMAND
  847.     if message.content.startswith('{0}test'.format(s_id[message.server.id])):
  848.         cmd = 'test'
  849.         file = open('bot_save_files\\server_id.txt', 'a')
  850.         file.write(str(str(s_id.keys()).split("'")))
  851.         file.close()
  852.        
  853.         try:
  854.             print(message.author.id, message.content, message.server, message.server.id)
  855.             await client.send_message(message.channel, message.server.id)
  856.         except:
  857.             print(error)
  858.  
  859.     #MUSIC LOOP
  860.     if message.content.startswith('{0}loop'.format(s_id[message.server.id])):
  861.         if not message.server.id in loop:
  862.             loop[message.server.id] = True
  863.             msg = 'Looping current song!'
  864.             await client.send_message(message.channel, msg)
  865.            
  866.         elif loop[message.server.id] == True:
  867.             loop[message.server.id] = False
  868.             msg = 'Loop of the current song disabled!'
  869.             await client.send_message(message.channel, msg)
  870.            
  871.         elif loop[message.server.id] == False:
  872.             loop[message.server.id] = True
  873.             msg = 'Looping current song!'
  874.             await client.send_message(message.channel, msg)
  875.  
  876.  
  877.     #MUSIC LOOP PLAYLIST
  878.     if message.content.startswith('{0}lp'.format(s_id[message.server.id])):
  879.         if not message.server.id in lp:
  880.             lp[message.server.id] = True
  881.             msg = 'Looping current playlist!'
  882.             await client.send_message(message.channel, msg)
  883.            
  884.         elif lp[message.server.id] == True:
  885.             lp[message.server.id] = False
  886.             msg = 'Loop of the current playlist disabled!'
  887.             await client.send_message(message.channel, msg)
  888.            
  889.         elif lp[message.server.id] == False:
  890.             lp[message.server.id] = True
  891.             msg = 'Looping current playlist!'
  892.             await client.send_message(message.channel, msg)
  893.            
  894.     #MUSIC CONNECT
  895.     if message.content.startswith("{0}p ".format(s_id[message.server.id])):
  896.         channel = message.author.voice.voice_channel
  897.        
  898.         if not message.server.id in loop:
  899.             loop[message.server.id] = False
  900.  
  901.         if not message.server.id in lp:
  902.             lp[message.server.id] = False
  903.            
  904.         if not channel == None:
  905.             ytdl = YoutubeDL()
  906.             link = ''
  907.             if not message.server.id in playlist:
  908.                 playlist[message.server.id] = []
  909.             if not message.server.id in cp:
  910.                 cp[message.server.id] = 'False'
  911.  
  912.             link = str(message.content).strip('{0}p '.format(s_id[message.server.id]))
  913.             playlist[message.server.id].append(link)
  914.             await music_playlist(message)        # music_playlist
  915.         else:
  916.             msg = "S-senpai..! You're n-not in a-any voice c-channel!"
  917.             await client.send_message(message.channel, msg)
  918.  
  919.     #MUSIC DISCONENCT
  920.     if message.content.startswith('{0}dc'.format(s_id[message.server.id])):
  921.         if client.is_voice_connected(message.server):
  922.             playlist[message.server.id] = []
  923.             cp[message.server.id] = 'False'
  924.             players[message.server.id].stop()
  925.             loop[message.server.id] = False
  926.             lp[message.server.id] = False
  927.             cpsong[message.server.id] = ''
  928.            
  929.             await vc.disconnect()
  930.            
  931.         else:
  932.             msg = "S-senpai..! B-but I.. I'm n-not connected y-yet! :flushed:"
  933.             await client.send_message(message.channel, msg)
  934.  
  935.     #MUSIC PLAYLIST
  936.     if message.content.startswith('{0}playlist'.format(s_id[message.server.id])):
  937.         mes = str(message.content).strip('{0}playlist'.format(s_id[message.server.id]))
  938.         if 'del' in mes:
  939.             mes = mes.strip(' del ')
  940.             try:
  941.                 num = int(mes)
  942.                 del(playlist[message.server.id][num])
  943.                 msg = 'Done..!'
  944.                 await client.send_message(message.channel, msg)
  945.             except:
  946.                 msg = 'Something went wrong!'
  947.                 await client.send_message(message.channel, msg)
  948.                
  949.         elif 'delete' in mes:
  950.             mes = mes.strip(' delete ')
  951.             try:
  952.                 num = int(mes)
  953.                 del(playlist[message.server.id][num])
  954.                 msg = 'Done..!'
  955.                 await client.send_message(message.channel, msg)
  956.             except:
  957.                 msg = 'Something went wrong!'
  958.                 await client.send_message(message.channel, msg)
  959.         else:
  960.             urls = []
  961.             urls = playlist[message.server.id]
  962.             msg = '***Current playlist:*** '
  963.             for i in range(len(urls)):
  964.                 msg = '{0}\n**{1}**: {2}'.format(msg, i+1, urls[i])
  965.             msg = '{0}\n{1}'.format(msg, '***You can remove song from queue my using {0}playlist del number_in_queue!**'.format(s_id[message.server.id]))
  966.             await client.send_message(message.channel, msg)
  967.  
  968.  
  969.     #MUSIC SKIP
  970.     if message.content.startswith('{0}skip'.format(s_id[message.server.id])):
  971.         await music_skip(message)
  972.  
  973. async def music_playlist(message):
  974.     global vc, cp, playlist, urllist
  975.    
  976.     url = playlist[message.server.id][0]
  977.    
  978.     if (cp[message.server.id] == 'False') and (playlist[message.server.id] != []):
  979.         await music_bot(url, message)
  980.        
  981.  
  982. async def music_bot(url, message):
  983.     global vc, cp, playlist, urllist, loop, ytdl, cpsong
  984.  
  985.     if not message.server.id in cpsong:
  986.         cpsong[message.server.id] = ''
  987.     cpsonglocal = {}
  988.  
  989.     cpsong[message.server.id] = str(url)
  990.     cpsonglocal[message.server.id] = str(url)
  991.     if not client.is_voice_connected(message.server):
  992.         while playlist[message.server.id] != []:
  993.  
  994.             channel = message.author.voice.voice_channel
  995.             vc = await client.join_voice_channel(channel)
  996.             musicplayer = await vc.create_ytdl_player(url, before_options=" -reconnect 1 -reconnect_streamed 1"
  997.                                                                            " -reconnect_delay_max 5")
  998.             players[message.server.id] = musicplayer
  999.             musicplayer.start()
  1000.             cp[message.server.id] = 'True'
  1001.            
  1002.             info = ytdl.extract_info(url, download = False)
  1003.             formats = info['formats']
  1004.            
  1005.             await asyncio.sleep(int(info['duration'])-1)
  1006.             #print('Song thingies: Global:{0}    Local:{1}'.format(cpsong[message.server.id], cpsonglocal[message.server.id]))
  1007.             if cpsong[message.server.id] == cpsonglocal[message.server.id]:
  1008.                 cp[message.server.id] = 'False'
  1009.                 await loop_check(url, message)
  1010.             else:
  1011.                 return
  1012.                 print('no')
  1013.                
  1014.     elif client.is_voice_connected(message.server):
  1015.         while playlist[message.server.id] != []:
  1016.             vc = client.voice_client_in(message.server)
  1017.             #players[message.server.id].stop()
  1018.             musicplayer = await vc.create_ytdl_player(url, before_options=" -reconnect 1 -reconnect_streamed 1"
  1019.                                                                            " -reconnect_delay_max 5")
  1020.             players[message.server.id] = musicplayer
  1021.             musicplayer.start()
  1022.             cp[message.server.id] = 'True'
  1023.            
  1024.             info = ytdl.extract_info(url, download = False)
  1025.             formats = info['formats']
  1026.            
  1027.             await asyncio.sleep(int(info['duration'])-1)
  1028.             #print('Song thingies: Global:{0}    Local:{1}'.format(cpsong[message.server.id], cpsonglocal[message.server.id]))
  1029.             if cpsong[message.server.id] == cpsonglocal[message.server.id]:
  1030.                 cp[message.server.id] = 'False'
  1031.                 await loop_check(url, message)
  1032.             else:
  1033.                 return
  1034.                 print('no')
  1035.     print('END OF CURRENT SONG {0}\n'.format(cpsonglocal[message.server.id]))
  1036.                    
  1037.    
  1038. async def loop_check(url, message):
  1039.     global loop, playlist, urllist, lp
  1040.  
  1041.     if lp[message.server.id] == True:
  1042.  
  1043.         playlist[message.server.id].append(url)
  1044.         del(playlist[message.server.id][0])
  1045.    
  1046.         await music_playlist(message)
  1047.        
  1048.     else:
  1049.    
  1050.         if loop[message.server.id] == True:
  1051.             await music_bot(url, message)
  1052.         elif loop[message.server.id] == False:
  1053.             del(playlist[message.server.id][0])
  1054.             await music_playlist(message)
  1055.  
  1056. async def music_skip(message):
  1057.     global players, playlist, urllist, cp, urls
  1058.  
  1059.     #for i in message.server.roles:
  1060.     #    print(i, type(i))
  1061.     if 'DJ' in message.server.roles:
  1062.         print('SKIP TEST 1')
  1063.         if 'DJ' in message.author.roles:
  1064.  
  1065.             print('SKIP TEST 2')
  1066.             cp[message.server.id] = 'False'
  1067.             players[message.server.id].stop()
  1068.             playlist[message.server.id] = playlist[message.server.id][len(urls[message.server.id])+7:]
  1069.             msg = 'Skipping current song...'
  1070.             await client.send_message(message.channel, msg)
  1071.             await music_playlist(message)
  1072.         else:
  1073.             msg = 'Insufficent permission!'
  1074.             await client.send_message(message.channel, msg)
  1075.             print('SKIP TEST 3')
  1076.     else:
  1077.         if lp[message.server.id] == True:
  1078.        
  1079.             playlist[message.server.id].append(playlist[message.server.id][0])
  1080.             del(playlist[message.server.id][0])
  1081.            
  1082.         else:
  1083.             del(playlist[message.server.id][0])
  1084.         cp[message.server.id] = 'False'
  1085.         players[message.server.id].stop()
  1086.         msg = 'Skipping current song...'
  1087.         await client.send_message(message.channel, msg)
  1088.         await music_playlist(message)
  1089.    
  1090. async def miku_reaction(message):
  1091.     global miku_names
  1092.     for i in miku_names:
  1093.         if i in message.content:
  1094.             await asyncio.sleep(0.37)
  1095.             msg = random.choice(miku_message).format(message.author.mention)
  1096.             await client.send_message(message.channel, msg)
  1097.             return
  1098.            
  1099.  
  1100. statuses = ["with Lily", "with Ana", "with Yuno", "with Eri", "with Honoka", "with Nico", "with Nico", "with Nico Nico Niii~",
  1101.             "with Maki", "with herself", "with her toys", "with Nozomi", "with Kotori", "with Umi", "with Rin", "with Hanayo",
  1102.             "with Chika", "with Riko", "with Kanan", "with Dia", "with You-chan", "with Yoshiko", "with Yohanne", "with Hanamaru zuraaa~",
  1103.             "with Mari", "with Ruby", "with Taiga", "with her phone", "with Toastie", "with Ado-kun", "with adorable Ana-chan",
  1104.             "with Mashiro", "with Yuzu", "with Sprii", "with Katalina", "with her creator", "with Angela", "with her hair", "with Aqours", "with µ's",
  1105.             "with Luka", "Doki Doki Literature Club", "with Natsuki..?", "with Yuri", "with Sayori", "with Hana", "with her friends",
  1106.             "with Faerlynn", "nothing... Weird...", "with Satou", "with Shio", "with Livvy", "as Mercy", "as Ana", "as Brigitte", "as Pharah", "as D.Va",
  1107.             "as Mei", "as Sombra", "as Ashe", "as Moira", "as Symmetra", "as Tracer", "as Zarya", "as Miku", "as Luka", "as Athena", "as Echo",
  1108.             "as Efi", "with Katniss", "never have I ever"]
  1109.  
  1110.  
  1111. async def task_loop():
  1112.     while True:
  1113.         me = discord.utils.find(lambda s: s != None, client.servers).me
  1114.         if not me:
  1115.                 return
  1116.         elif not me.game:
  1117.                 updated_game = discord.Game(name = random.choice(statuses))              
  1118.         else:
  1119.                 updated_game = me.game
  1120.                 updated_game.name = random.choice(statuses)              
  1121.         await client.change_presence(game = updated_game)
  1122.         print('Setting game to: Playing {0}'.format(str(updated_game)))
  1123.         await asyncio.sleep(300)
  1124.  
  1125.  
  1126. @client.event
  1127. async def on_ready():
  1128.     global start, statuses
  1129.     print('Logged in as:', client.user.name)
  1130.     print('Client ID:',client.user.id)
  1131.     print('Loading files...')
  1132.     reload_files()
  1133.     if success == False:
  1134.         print('Files loaded successfully')
  1135.     else:
  1136.         print("Loading of files unsuccessfull")
  1137.     end = timeit.timeit()
  1138.     print('Started up in', round((end - start)*100, 2), 'seconds')
  1139.     client.loop.create_task(task_loop())
  1140.     await asyncio.sleep(0.5)
  1141.     print('------------')
  1142.  
  1143. TOKEN = '<removed>'      
  1144. client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement