SHARE
TWEET

Miku v0.18.3 (27.12.2018)

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