Advertisement
Faerlynn

Miku v0.17.2 (18.12.2018)

Dec 18th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 44.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.  
  191.  
  192. @client.event
  193. async def on_message(message):
  194.     global game_number, game_active, error, round_active, attempts, about, player, author, msg, version, s_id, gmn_cp, success
  195.     global miku_message, edits, statuses, players, vc, playlist, cp
  196.     if message.author == client.user:
  197.         return
  198.  
  199.     if not message.server.id in s_id:
  200.         s_id[message.server.id] = '$'
  201.         print('Creating a backup...')
  202.         msg = 'Creating a first settings for your server!'
  203.         await client.send_message(message.channel, msg)
  204.         save()
  205.         reload_files()
  206.         return
  207.    
  208.     #done       HELLO
  209.     if message.content.startswith('{0}hello'.format(s_id[message.server.id])):
  210.         cmd = 'hello'
  211.         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])
  212.         log(msg, message.channel, message.author, cmd)
  213.         await client.send_message(message.channel, msg)
  214.  
  215.     #done       LOVE
  216.     if message.content.startswith('{0}love'.format(s_id[message.server.id])):
  217.         cmd = 'love'
  218.         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*"
  219.         log(msg, message.channel, message.author, cmd)
  220.         await client.send_message(message.channel, msg)
  221.  
  222.     #done       RANDOM NUMBER
  223.     if message.content.startswith('{0}random'.format(s_id[message.server.id])):
  224.         cmd = 'random'
  225.         msg = ('Randomly generated number: '+str(random.randrange(101)))
  226.         log(msg, message.channel, message.author, cmd)
  227.         await client.send_message(message.channel, msg)
  228.  
  229.     #done       POKE
  230.     if message.content.startswith('{0}poke'.format(s_id[message.server.id])):
  231.         cmd = "poke"
  232.         msg = str(message.content)[6:]
  233.         msg_list = msg.split(' ')
  234.         msg_recipient = ''
  235.         msg_author = str(message.author)[:-5]
  236.         msg_content_test = False
  237.         for i in range(len(msg_list)):
  238.             msg_check = msg_list[i]
  239.             if (('<@!' and '>') in msg_check) == True:
  240.                 msg_recipient = msg_check
  241.                 msg_content_test = True
  242.         if msg_content_test == False:
  243.             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.*"
  244.         else:
  245.             msg = '*' + msg_author + " pokes " + msg_recipient + "'s shoulder gently and then just waits for their response patiently.*"
  246.         log(msg, message.channel, message.author, cmd)
  247.         await client.send_message(message.channel, msg)
  248.         if msg_recipient == '<@!492432534181773313>':
  249.             time.sleep(1)
  250.             msg = "*She looks at {0.author.mention} curiously, and after moment she pokes {0.author.mention}'s nose back.*".format(message)
  251.             await client.send_message(message.channel, msg)
  252.  
  253.     #done       CUDDLE
  254.     if message.content.startswith('{0}cuddle'.format(s_id[message.server.id])):
  255.         cmd = 'cuddle'
  256.         try:
  257.             msg = str(message.content)[8:]
  258.             msg_list = msg.split(' ')
  259.             msg_recipient = ''
  260.             msg_author = str(message.author)[:-5]
  261.             msg_content_test = False
  262.            
  263.             for i in range(len(msg_list)):
  264.                 msg_check = msg_list[i]
  265.                 if (('<@!' and '>') in msg_check) == True:
  266.                     msg_recipient = msg_check
  267.                     msg_content_test = True
  268.             if len(msg_recipient) == 21:
  269.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  270.             if msg_recipient == str(message.author.mention):
  271.                 msg = random.choice(cuddle_message).format('Miku', msg_recipient)
  272.             else:
  273.            
  274.                 if not msg_content_test:
  275.                     msg = '*' + msg_author + " cuddles their pillow, smiling but alone.*"
  276.                 else:
  277.                     msg = random.choice(cuddle_message).format(msg_author, msg_recipient)
  278.             log(msg, message.channel, message.author, cmd)
  279.        
  280.             await client.send_message(message.channel, msg)
  281.         except ValueError in error:
  282.             print(error)
  283.             await client.send_message(message.channel, 'Something went wrong.... :sob:')
  284.        
  285.  
  286.     #done       HUG
  287.     if message.content.startswith('{0}hug'.format(s_id[message.server.id])):
  288.         cmd = 'hug'
  289.         msg = str(message.content)[5:]
  290.         msg_list = msg.split(' ')
  291.         msg_recipient = ''
  292.         msg_author = str(message.author)[:-5]
  293.         msg_content_test = False
  294.         for i in range(len(msg_list)):
  295.             msg_check = msg_list[i]
  296.             if (('<@!' and '>') in msg_check) == True:
  297.                 msg_recipient = msg_check
  298.                 msg_content_test = True
  299.         if not msg_content_test:
  300.             msg_recipient = 'bottle of expensive red wine'
  301.         if len(msg_recipient) == 21:
  302.             msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  303.         if msg_recipient == str(message.author.mention):
  304.             msg = random.choice(hug_message).format('Miku', msg_recipient)
  305.         else:
  306.             msg = random.choice(hug_message).format(msg_author, msg_recipient)
  307.         log(msg, message.channel, message.author, cmd)
  308.         try:
  309.             await client.send_message(message.channel, msg)
  310.         except ValueError in error:
  311.             print(error)
  312.             await client.send_message(message.channel, 'Something went wrong.... :sob:')
  313.  
  314.     #done       KISS
  315.     if message.content.startswith('{0}kiss'.format(s_id[message.server.id])):
  316.         cmd = 'kiss'
  317.         msg = str(message.content)[5:]
  318.         msg_list = msg.split(' ')
  319.         msg_recipient = ''
  320.         msg_author = str(message.author)[:-5]
  321.         msg_content_test = False
  322.         for i in range(len(msg_list)):
  323.             msg_check = msg_list[i]
  324.             if (('<@!' and '>') in msg_check) == True:
  325.                 msg_recipient = msg_check
  326.                 msg_content_test = True
  327.         if msg_content_test == False:
  328.             msg_recipient = 'bottle of expensive red wine'
  329.         if len(msg_recipient) == 21:
  330.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  331.         if msg_recipient == str(message.author.mention):
  332.             msg = random.choice(kiss_message).format('Miku', msg_recipient)
  333.         else:
  334.             msg = random.choice(kiss_message).format(msg_author, msg_recipient)
  335.         log(msg, message.channel, message.author, cmd)
  336.         try:
  337.             await client.send_message(message.channel, msg)
  338.         except ValueError in error:
  339.             print(error)
  340.             await client.send_message(message.channel, 'Something went wrong.... :sob:')
  341.  
  342.     #done       PAT
  343.     if message.content.startswith('{0}pat'.format(s_id[message.server.id])):
  344.         cmd = 'pat'
  345.         if '{0}pat '.format(s_id[message.server.id]) in message.content:
  346.             msg = str(message.content)[4:]
  347.             msg_list = msg.split(' ')
  348.             msg_recipient = ''
  349.             msg_author = str(message.author)[:-5]
  350.             msg_content_test = False
  351.             for i in range(len(msg_list)):
  352.                 msg_check = msg_list[i]
  353.                 if (('<@!' and '>') in msg_check) == True:
  354.                     msg_recipient = msg_check
  355.                     msg_content_test = True
  356.             if msg_content_test == False:
  357.                 msg_recipient = 'invisible unicorn'
  358.             if len(msg_recipient) == 21:
  359.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  360.             if msg_recipient == str(message.author.mention):
  361.                 msg = random.choice(pat_message).format('Miku', msg_recipient)
  362.             else:
  363.                 msg = random.choice(pat_message).format(msg_author, msg_recipient)
  364.             log(msg, message.channel, message.author, cmd)
  365.             try:        
  366.                 await client.send_message(message.channel, msg)
  367.             except ValueError in error:
  368.                 print(error)
  369.                 await client.send_message(message.channel, 'Something went wrong.... :sob:')
  370.  
  371.     #SLAP
  372.     if message.content.startswith('{0}slap'.format(s_id[message.server.id])):
  373.         cmd = 'slap'
  374.         if '{0}slap '.format(s_id[message.server.id]) in message.content:
  375.             msg = str(message.content)[5:]
  376.             msg_list = msg.split(' ')
  377.             msg_recipient = ''
  378.             msg_author = str(message.author)[:-5]
  379.             msg_content_test = False
  380.             for i in range(len(msg_list)):
  381.                 msg_check = msg_list[i]
  382.                 if (('<@!' and '>') in msg_check) == True:
  383.                     msg_recipient = msg_check
  384.                     msg_content_test = True
  385.             if msg_content_test == False:
  386.                 msg_recipient = 'air'
  387.             if len(msg_recipient) == 21:
  388.                 msg_recipient = msg_recipient[:2] + '!' + msg_recipient[2:]
  389.             if msg_recipient == str(message.author.mention):
  390.                 msg = random.choice(pat_message).format('Miku', msg_recipient)
  391.             else:
  392.                 msg = random.choice(slap_message).format(msg_author, msg_recipient)
  393.             log(msg, message.channel, message.author, cmd)
  394.             try:
  395.                 abc = str(message.author.mention).strip('<')
  396.                 await client.send_message(message.channel, msg)
  397.                
  398.             except ValueError in error:
  399.                 print(error)
  400.                 await client.send_message(message.channel, 'Something went wrong.... :sob:')
  401.    
  402.  
  403.     #WIP               <-----------------------------------------------------
  404.     if message.content.startswith('{0}help'.format(s_id[message.server.id])):
  405.         cmd = 'help'
  406.         msg = """**{0}hello** - yes, this is my greeting to all of you, my users! ^~^
  407.        **{0}kiss @user** - kisses your lovely friend
  408.        **{0}hug @user** - hugs your hugging-friend
  409.        **{0}poke @user** - pokes your victim
  410.        **{0}cuddle @user** - cuddles your cuddle pillow friend
  411.        **{0}pat @user** - pat your friend's head and make them blush with happiness
  412.        **{0}slap @user** - slap someone who's being rude! Ouch!
  413.        **{0}rnf x z** - gives you random number from between numbers **x** and **z**
  414.        **{0}random** - gives you random number between **0** and **100**
  415.        **{0}choice a, b, c, d, ...** - makes a choice for you from the list words, each one divided with ","
  416.        **{0}rc** - gives you a random colour in hex format
  417.        **{0}p <youtube url>** - plays song in voice channel you're conencted to
  418.        **{0}dc** - disconnects bot from voice channel
  419.        **{0}coinflip** - flips the coin. Try your luck!
  420.        **{0}gmn** - first minigame! Guess my number! Collect points and get on top of the leaderboard! ***<Rankings And Points Not Yet Implemented>***
  421.        **{0}invite** - sends you a special link with which you can invite this bot to ***your own server***
  422.        **{0}about** - do you want to learn more about me and my creator? Don't wait any longer!
  423.        **{0}chart** - shows you a simple japanese katakana and hiragana chart! *For all weebs who can't type in their mother language..* >.>
  424.        **{0}prefix set <prefix>** - allows owner of the server to change prefix to which my commands will react in that server
  425.        **{0}lewd** - *winks*""".format(s_id[message.server.id])
  426.         color = 4122822
  427.         embed = discord.Embed(title = 'List of my commands:', description = msg, color = color)
  428.         log(msg, message.channel, message.author, cmd)
  429.         await client.send_message(message.author, embed = embed)
  430.         await client.add_reaction(message, '\U00002705')
  431.  
  432.     #done       ABOUT
  433.     if message.content.startswith('{0}about'.format(s_id[message.server.id])):
  434.         cmd = 'about'
  435.         log(msg, message.channel, message.author, cmd)
  436.         await client.send_message(message.channel, about)
  437.  
  438.     #done       CHART
  439.     if message.content.startswith('{0}chart'.format(s_id[message.server.id])):
  440.         cmd = 'chart'
  441.         msg = '''**ๆ—ฅ ๏ฝ ๏ฝ‰ ๏ฝ• ๏ฝ… ๏ฝใ€€๏ฝ ๏ฝ‰ ๏ฝ• ๏ฝ… ๏ฝ ๆœฌ
  442.        ใƒผ ใ‚ข ใ‚ค ใ‚ฆ ใ‚จ ใ‚ชใ€€ใ‚ ใ„ ใ† ใˆ ใŠ
  443.        ๏ฝ‹ ใ‚ซ ใ‚ญ ใ‚ฏ ใ‚ฑ ใ‚ณใ€€ใ‹ ใ ใ ใ‘ ใ“
  444.        ๏ฝ“ ใ‚ต ใ‚ท ใ‚น ใƒ‡ ใ‚ฝใ€€ใ• ใ— ใ™ ใ› ใ
  445.        ๏ฝ” ใ‚ฟ ใƒ ใƒ„ ใƒ† ใƒˆใ€€ใŸ ใก ใค ใฆ ใจ
  446.        ๏ฝŽ ใƒŠ ใƒ‹ ใƒŒ ใƒ ใƒŽใ€€ใช ใซ ใฌ ใญ ใฎ
  447.        ๏ฝ ใƒž ใƒŸ ใƒ  ใƒก ใƒขใ€€ใพ ใฟ ใ‚€ ใ‚ ใ‚‚
  448.        ๏ฝ’ ใƒฉ ใƒช ใƒซ ใƒฌ ใƒญใ€€ใ‚‰ ใ‚Š ใ‚‹ ใ‚Œ ใ‚
  449.        ๏ฝˆ ใƒ ใƒ’ ใƒ• ใƒ˜ ใƒ›ใ€€ใฏ ใฒ ใต ใธ ใป
  450.        ๏ฝ— ใƒฏ ใ€€ ใ€€ ใ€€ ใƒฒใ€€ใ‚  ใ€€ใ€€ ใ€€ ใ‚’
  451.        ๏ฝ™ ใƒค ใ€€ ใƒฆ ใ€€ ใƒจใ€€ใ‚„  ใ€€ใ‚† ใ€€ ใ‚ˆ
  452.        ๏ฝŽ ใƒณ ใ€€ ใ€€ ใ€€ ใ€€ใ€€ใ‚“**'''
  453.         color = 4122822
  454.         embed = discord.Embed(title = 'Katakana and hiragana chart:', description = msg, color = color)
  455.         log(msg, message.channel, message.author, cmd)
  456.         await client.send_message(message.channel, embed = embed)
  457.  
  458.     #done       AYAYA AYAYAAAAAA
  459.     if (message.content.startswith('ayaya')) or (message.content.startswith('AYAYA')):
  460.         cmd = 'ayaya'
  461.         msg = '''**โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโฃฌโก›โฃฟโฃฟโฃฟโฃฏโขป
  462. โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกŸโขปโฃฟโฃฟโขŸโฃปโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฎโกปโฃฟโฃฟโฃง
  463. โฃฟโฃฟโฃฟโฃฟโฃฟโขปโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃ†โ ปโกซโฃขโ ฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโฃœโขปโฃฟ
  464. โฃฟโฃฟโกโฃฟโฃฟโฃจโฃโ ฟโฃฟโฃฟโฃฟโฃฟโฃฟโข•โ ธโฃ›โฃฉโฃฅโฃ„โฃฉโขโฃ›โกฟโ ฟโฃฟโฃฟโฃ†โข
  465. โฃฟโฃฟโขกโฃธโฃฟโฃโฃฟโฃฟโฃถโฃฏโฃ™โ ซโขบโฃฟโฃทโกˆโฃฟโฃฟโฃฟโฃฟโกฟโ ฟโขฟโฃŸโฃ’โฃ‹โฃ™โ Š
  466. โฃฟโกโกฟโฃ›โฃโขฟโฃฎโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃถโฃถโฃถโฃถโฃพโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟ
  467. โฃฟโขฑโฃพโฃฟโฃฟโฃฟโฃโกฎโกปโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโ ฟโ ›โฃ‹โฃปโฃฟโฃฟโฃฟโฃฟ
  468. โขฟโขธโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโฃฝโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโก•โฃกโฃดโฃถโฃฟโฃฟโฃฟโกŸโฃฟโฃฟโฃฟ
  469. โฃฆโกธโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโก›โขฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโก‡โฃฟโฃฟโฃฟ
  470. โข›โ ทโกนโฃฟโ ‹โฃ‰โฃ โฃคโฃถโฃถโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโ ฟโขฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโขนโฃฟโฃฟ
  471. โฃทโกโฃฟโกžโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกŸโ ‹โ โฃ โฃคโฃคโฃฆโฃฝโฃฟโฃฟโฃฟโกฟโ ‹โ ˜โฃฟโฃฟ
  472. โฃฟโฃฟโกนโฃฟโกผโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃงโกฐโฃฟโฃฟโฃฟโฃฟโฃฟโฃนโกฟโ Ÿโ ‰โก€โ „โ „โขฟโฃฟ
  473. โฃฟโฃฟโฃฟโฃฝโฃฟโฃผโฃ›โ ฟโ ฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฏโฃฟโ ฟโขŸโฃปโกฝโขšโฃคโกžโ „โ „โ „โขธโฃฟ**'''
  474.         log(msg, message.channel, message.author, cmd)
  475.         await client.send_message(message.channel, msg)
  476.  
  477.     #done       INVITE
  478.     if message.content.startswith('{0}invite'.format(s_id[message.server.id])):
  479.         msg = "*You can invite me to your server using this link:*\nhttps://discordapp.com/oauth2/authorize?client_id=492432534181773313&scope=bot"
  480.         await client.send_message(message.author, msg)
  481.  
  482.     #done       CHOICE
  483.     if message.content.startswith('{0}choice'.format(s_id[message.server.id])):
  484.         cmd = 'choice'
  485.         msg = message.content[8:]
  486.         choice_list = []
  487.         choice_list = msg.split(',')
  488.         msg = "I've randomly chosen this for you: " + str(random.choice(choice_list))
  489.         log(msg, message.channel, message.author, cmd)
  490.         await client.send_message(message.channel, msg)
  491.  
  492.     #done       PATCHNOTES
  493.     if message.content.startswith('{0}patchnotes'.format(s_id[message.server.id])):
  494.         cmd = 'patchnotes'
  495.         p_notes_split = patchnotes.split('<$>')
  496.         #print(p_notes_split)
  497.         log(msg, message.channel, message.author, cmd)
  498.         for i in p_notes_split:
  499.             msg = '```{0}```'.format(i)
  500.             await client.send_message(message.author, msg)
  501.  
  502.     #done       VERSION
  503.     if message.content.startswith('{0}version'.format(s_id[message.server.id])):
  504.         cmd = 'version'
  505.         msg = '`Current version of this bot is: {0}`'.format(version)
  506.         log(msg, message.channel, message.author, cmd)
  507.         await client.send_message(message.channel, msg)
  508.  
  509.     #done       RANDOM NUMBER X Z
  510.     if message.content.startswith('{0}rnf'.format(s_id[message.server.id])):
  511.         cmd = 'random number from <x, z>'
  512.         msg = message.content[5:]
  513.         numbers = []
  514.         numbers = msg.split(' ')
  515.         log(msg, message.channel, message.author, cmd)
  516.         error = ''
  517.         if len(numbers) == (1 or 0):
  518.             msg = 'You need two numbers!'
  519.             await client.send_message(message.channel, msg)
  520.         else:
  521.             try:
  522.                 print(numbers[0], numbers[1])
  523.                 a = int(round(float(numbers[0])))
  524.                 b = int(round(float(numbers[1])))
  525.                 print(a, b)
  526.                
  527.                 if a >= b:
  528.                     c = a
  529.                     a = b
  530.                     b = c
  531.                    
  532.                 if a == b:
  533.                     msg = "Your random number is not really random, but here you go: {0}".format(a)
  534.                 else:
  535.                     num = random.randrange(a, b+1)
  536.                     msg = "Your random number is: " + str(num)
  537.                 await client.send_message(message.channel, msg)
  538.                
  539.             except ValueError as error:
  540.                 print(error)
  541.                 msg = 'Something went wrong!'
  542.                 await client.send_message(message.channel, msg)
  543.  
  544.     #done       COINFLIP
  545.     if message.content.startswith('{0}coinflip'.format(s_id[message.server.id])):
  546.         cmd = 'coinflip'
  547.         num = random.randrange(1000)+1
  548.         if num == 741:
  549.             msg = "***It landed on it's side! How lucky!!!***"
  550.         else:
  551.             if num == 274:
  552.                 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..."
  553.             else:
  554.                 if num > 500:
  555.                     msg = 'Heads!' + '!'*random.randrange(4)
  556.                 else:
  557.                     msg = 'Tails!' + '!'*random.randrange(4)
  558.         #log(msg, message.channel, message.author, cmd)
  559.         print("Command '$" + cmd + "' used in " + str(message.channel) + ' by ' + str(message.author) +'! Rolled: ' + str(num))
  560.         await client.send_message(message.channel, msg)
  561.  
  562.     #done       RANDOM COLOUR
  563.     if message.content.startswith('{0}rc'.format(s_id[message.server.id])):
  564.         cmd = 'random colour'
  565.         color = random.randrange(256**3)
  566.         print(color)
  567.         msg = str(f'#{color:06x}')
  568.         embed = discord.Embed(title = 'Your random colour: ', description = msg, color = color)
  569.         log(str(msg), message.channel, message.author, cmd)
  570.         await client.send_message(message.channel, embed = embed)
  571.  
  572.     #done       GUESS MY NUMBER
  573.     if message.content.startswith('{0}gmn'.format(s_id[message.server.id])):
  574.        
  575.         if not str(message.author) in gmn_cp:
  576.             gmn_cp[str(message.author)] = False
  577.             gmn_a[str(message.author)] = 0
  578.             gmn_number[str(message.author)] = 0
  579.            
  580.         if gmn_cp[str(message.author)] == False:
  581.             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..!!")
  582.             time.sleep(0.25)
  583.             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]))
  584.             game_number = random.randrange(100)+1
  585.             gmn_number[str(message.author)] = game_number
  586.             gmn_a[str(message.author)] = 0
  587.             player = str(message.author)
  588.             gmn_cp[str(message.author)] = True
  589.            
  590.         elif gmn_cp[str(message.author)] == True:
  591.             number = message.content[4:]
  592.             try:
  593.                 number = int(number)
  594.                 gmn_cp[str(message.author)] = True
  595.                
  596.                 if gmn_number[str(message.author)] == number:
  597.                     msg = "Y-yes..! That's the number I.. I've been thinking of! Y-you are so good s-senpai! :heart_eyes:"
  598.                     gmn_a[str(message.author)] = 0
  599.                     await client.send_message(message.channel, msg)
  600.                     gmn_a[str(message.author)] = 0
  601.                     gmn_cp[str(message.author)] = False
  602.  
  603.                    
  604.                 elif (gmn_a[str(message.author)] == 0) and (gmn_cp[str(message.author)] == True):
  605.  
  606.                     if gmn_number[str(message.author)] < number:
  607.                         msg = "T-that's not it, s-senpai..! :flushed: Your n-number is too b-big.. T-try again..! *blushes*"
  608.                         await client.send_message(message.channel, msg)
  609.                     else:
  610.                         msg = "T-that's not it, s-senpai..! :flushed: Your n-number is not b-big enough.. T-try again..! *blushes*"
  611.                         await client.send_message(message.channel, msg)
  612.  
  613.                     gmn_a[str(message.author)] = 1
  614.                     print('New game! Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  615.                    
  616.                 elif (gmn_a[str(message.author)] == 1) and (gmn_cp[str(message.author)] == True):
  617.  
  618.                    
  619.                     if gmn_number[str(message.author)] < number:
  620.                         msg = "N-no senpai... S-still not my number.. It's n-not that big..."
  621.                         await client.send_message(message.channel, msg)
  622.                     else:
  623.                         msg = "N s-senpai... S-still not my special number.. It's even higher..."
  624.                         await client.send_message(message.channel, msg)
  625.                        
  626.                     gmn_a[str(message.author)] = 2
  627.                     print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  628.  
  629.                    
  630.                 elif (gmn_a[str(message.author)] == 2) and (gmn_cp[str(message.author)] == True):
  631.                    
  632.                     if gmn_number[str(message.author)] < number:
  633.                         msg = "That's again n-not my n-number *blushes* T-too big..! Last chance..!"
  634.                         await client.send_message(message.channel, msg)
  635.                     else:
  636.                         msg = "N-not my n-number, senpai..! *blushes* Go h-higher..! L-last attempt..!"
  637.                         await client.send_message(message.channel, msg)
  638.                        
  639.                     gmn_a[str(message.author)] = 3
  640.                     print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  641.                    
  642.                 elif (gmn_a[str(message.author)] == 3) and (gmn_cp[str(message.author)] == True):
  643.                    
  644.                     if gmn_number[str(message.author)] < number:
  645.                         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)])
  646.                         await client.send_message(message.channel, msg)
  647.                     else:
  648.                         msg = "S-senpai..! T-that's not my number..! I was t-thinking of a number " + str(gmn_number[str(message.author)])
  649.                         await client.send_message(message.channel, msg)
  650.                        
  651.                     print('Player: {0}, attempt: {1}, number: {2}'.format(message.author, gmn_a[str(message.author)], gmn_number[str(message.author)]))
  652.                     gmn_a[str(message.author)] = 0
  653.                     gmn_cp[str(message.author)] = False
  654.                    
  655.             except:
  656.                 await client.send_message(message.channel, "That's not a number, b-baka s-senpai..!!")
  657.         else:
  658.             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:")
  659.  
  660.  
  661.     #done       LEWD
  662.     if message.content.startswith('{0}lewd'.format(s_id[message.server.id])):
  663.         if str(message.author) == 'Ana#3140':
  664.             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..!__***'
  665.         else:
  666.             msg = '**Y-YOU ARE SO L-LEWD, SENPAI**' + '!'*int(random.randrange(9)+3)
  667.         await client.send_message(message.channel, msg)
  668.  
  669.     #done       SERVER PREFIX CHANGE
  670.     if message.content.startswith('{0}prefix set'.format(s_id[message.server.id])):
  671.         if message.author == message.server.owner:
  672.             try:
  673.                 prefix = message.content[12:]
  674.                 if len(prefix) > 1:
  675.                     msg = 'Prefix can consist of only one character!'
  676.                 else:
  677.                     s_id[message.server.id] = str(prefix)
  678.                     save()
  679.                     reload_files()
  680.                     msg = 'Prefix of this server has been changed to {0}'.format(prefix)
  681.             except:
  682.                 msg = 'Something went wrong!'
  683.         else:
  684.             msg = "I'm sorry s-senpai, b-but you are n-not owner of t-this server!"
  685.         await client.send_message(message.channel, msg)
  686.                
  687.  
  688.     #bet reaction
  689.     if (message.content.startswith('bet'))or (message.content.startswith('beet')) or (message.content.startswith('Bet')):
  690.         num = random.randrange(10000)
  691.         if num == 2714:
  692.             msg = 'BEEEEEEEEEEEEEEEEEEEEEEEEEEEET!!!!!'
  693.             await client.send_message(message.channel, msg)
  694.         else:
  695.             if num == 8743:
  696.                 msg = 'No bets allowed to underage trolls (That means you are not allowed to bet if you are not 18+.... B-baka senpai.. >.>)'
  697.                 await client.send_message(message.channel, msg)
  698.             else:
  699.                 msg = "{0}bet{0}".format(edits[random.randrange(5)])
  700.                 await client.send_message(message.channel, msg)
  701.  
  702.     #miku reaction
  703.     if ("Miku" in message.content) or ("miku" in message.content):
  704.         time.sleep(0.37)
  705.         msg = random.choice(miku_message).format(message.author.mention)
  706.         await client.send_message(message.channel, msg)
  707.  
  708.     #Reactions for other bots
  709.     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]))):
  710.         time.sleep(1)
  711.         #print(message.content)
  712.         msg = 'Awwwwww t-thanks a lot for petting me, {0}! :sparkling_heart: :heart_eyes: ^~^'.format(message.author.mention)
  713.         await client.send_message(message.channel, msg)
  714.  
  715.     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]))):
  716.         time.sleep(1)
  717.         msg = 'Oh~, thanks s-senpai for hug! *she hugs {0} back tightly, smiling and blushing.*'.format(message.author.mention)
  718.         await client.send_message(message.channel, msg)
  719.  
  720.     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]))):
  721.         time.sleep(1)
  722.         msg = '*She giggles and cuddles {0} back, slightly stroking their back, still giggling.*'.format(message.author.mention)
  723.         await client.send_message(message.channel, msg)
  724.        
  725.     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]))):
  726.         time.sleep(1)
  727.         msg = "*She looks at {0} curiously, and then she pokes {0} back.*".format(message.author.mention)
  728.         await client.send_message(message.channel, msg)
  729.  
  730.     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]))):
  731.         time.sleep(1)
  732.         msg = '*She slaps {0} back, looking angry, annoyed but dissappointed and sad as well...*'.format(message.author.mention)
  733.         await client.send_message(message.channel, msg)
  734.  
  735.  
  736.     #dev only functions
  737.  
  738.     #done       STOP
  739.     if (message.content.startswith('{0}stop'.format(s_id[message.server.id]))) or (message.content.startswith('{0}bye'.format(s_id[message.server.id]))):
  740.         author = str(message.author)
  741.         cmd = 'stop'
  742.         msg = ''
  743.         log(msg, message.channel, message.author, cmd)
  744.         if (author == 'Ana#3140') or (author == 'Cutie Kitty#0068'):
  745.             msg = 'Good bye!'
  746.             await client.send_message(message.channel, msg)
  747.             print('Good b-bye Ana s-senpai~ <3')
  748.             client.logout()
  749.             save()
  750.             sys.exit(0)
  751.         else:
  752.             msg = 'Insufficient permissions...'
  753.             await client.send_message(message.channel, msg)
  754.  
  755.     #done       RELOAD FILES
  756.     if message.content.startswith('{0}rf'.format(s_id[message.server.id])):
  757.         cmd = 'reload files'
  758.         log(msg, message.channel, message.author, cmd)
  759.         author = str(message.author)
  760.         if author == 'Ana#3140':
  761.             reload_files()
  762.             if success == False:
  763.                 print('Files reloaded successfully...')
  764.             else:
  765.                 print('Reload unsuccessful...')
  766.         else:
  767.             msg = 'Insufficient permissions...'
  768.             await client.send_message(message.channel, msg)
  769.  
  770.     #done       CHANGE GAME STATUS
  771.     if message.content.startswith('{0}game'.format(s_id[message.server.id])):
  772.         cmd = 'game status'
  773.         if (str(message.author) == 'Ana#3140') or (str(message.author) == 'Cutie Kitty#0068'):
  774.             if len(str(message.content)) >6:
  775.                 g = str(message.content)[6:]
  776.                 print(g, str(message.content))
  777.                 me = discord.utils.find(lambda s: s != None, client.servers).me
  778.                 if not me:
  779.                         return
  780.                 elif not me.game:
  781.                         updated_game = discord.Game(name = str(g))
  782.                 else:
  783.                         updated_game = me.game
  784.                         updated_game.name = str(g)
  785.             else:
  786.                 me = discord.utils.find(lambda s: s != None, client.servers).me
  787.                 if not me:
  788.                         return
  789.                 elif not me.game:
  790.                         updated_game = discord.Game(name = random.choice(statuses))
  791.                 else:
  792.                         updated_game = me.game
  793.                         updated_game.name = random.choice(statuses)
  794.             await client.change_presence(game = updated_game)
  795.             print('Changing game to: {0}'.format(str(updated_game)))
  796.            
  797.  
  798.     #done       PATCH CHANGE
  799.     if message.content.startswith('{0}patch set'.format(s_id[message.server.id])):
  800.         author = str(message.author)
  801.         cmd = 'patch'
  802.         msg = ''
  803.         patch = ''
  804.         log(msg, message.channel, message.author, cmd)
  805.         if author == 'Ana#3140':
  806.             try:
  807.                 msg = 'Done!'
  808.                 patch = message.content
  809.                 patch = patch[11:]
  810.                 os.remove('bot_save_files\patch.txt')
  811.                 file = open('bot_save_files\patch.txt', 'w')
  812.                 file.write(str(patch))
  813.                 file.close()
  814.                 version = patch
  815.                 print('Current patch changed to {0}'.format(patch))
  816.                 await client.send_message(message.channel, msg)
  817.             except:
  818.                 print('Something went wrong!')
  819.            
  820.     #WIP        TEST COMMAND
  821.     if message.content.startswith('{0}test'.format(s_id[message.server.id])):
  822.         cmd = 'test'
  823.         file = open('bot_save_files\\server_id.txt', 'a')
  824.         file.write(str(str(s_id.keys()).split("'")))
  825.         file.close()
  826.        
  827.         try:
  828.             print(message.author.id, message.content, message.server, message.server.id)
  829.             await client.send_message(message.channel, message.server.id)
  830.         except:
  831.             print(error)
  832.  
  833.     #MUSIC CONNECT
  834.     if message.content.startswith("{0}p ".format(s_id[message.server.id])):
  835.         channel = message.author.voice.voice_channel
  836.         if not channel == None:
  837.             print(channel, type(channel))
  838.             ytdl = YoutubeDL()
  839.             link = ''
  840.             if not message.server.id in playlist:
  841.                 playlist[message.server.id] = ''
  842.             if not message.server.id in cp:
  843.                 cp[message.server.id] = 'False'
  844.  
  845.             link = str(message.content).strip('{0}p '.format(s_id[message.server.id]))
  846.             playlist[message.server.id] = '{0}<split>{1}'.format(playlist[message.server.id], link)
  847.             await music_playlist(message)
  848.         else:
  849.             msg = "S-senpai..! You're n-not in a-any voice c-channel!"
  850.             await client.send_message(message.channel, msg)
  851.  
  852.     #MUSIC DISCONENCT
  853.     if message.content.startswith('{0}dc'.format(s_id[message.server.id])):
  854.         if client.is_voice_connected(message.server):
  855.             await vc.disconnect()
  856.             playlist[message.server.id] = ''
  857.             cp[message.server.id] = 'False'
  858.         else:
  859.             msg = "S-senpai..! B-but I.. I'm n-not connected y-yet! :flushed:"
  860.             await client.send_message(message.channel, msg)
  861.  
  862. async def music_playlist(message):
  863.     global vc, cp, playlist, urllist
  864.     urllist = []
  865.     urllist = playlist[message.server.id].split('<split>')
  866.                
  867.     url = str(urllist)
  868.     url = str(url[6:len(url)-2])
  869.     urllist = urllist.pop(1)
  870.     if (cp[message.server.id] == 'False') and (playlist[message.server.id] != ''):
  871.         print(playlist[message.server.id])
  872.         await music_bot(url, message)
  873.        
  874.  
  875. async def music_bot(url, message):
  876.     global vc, cp, playlist, urllist
  877.     ytdl = YoutubeDL()
  878.     #info = ytdl.extract_info(url, download = False)
  879.     #formats = info['formats']
  880.     try:
  881.         if client.is_voice_connected(message.server):
  882.             try:
  883.                 while playlist[message.server.id] != '':                    
  884.                     vc = client.voice_client_in(message.server)
  885.                     players[message.server.id].stop()
  886.                     musicplayer = await vc.create_ytdl_player(url, before_options=" -reconnect 1 -reconnect_streamed 1"
  887.                                                                                    " -reconnect_delay_max 5")
  888.                     players[message.server.id] = musicplayer
  889.                     musicplayer.start()
  890.                     cp[message.server.id] = 'True'
  891.                    
  892.                     info = ytdl.extract_info(url, download = False)
  893.                     formats = info['formats']
  894.                     print('Playing {0}\n'.format(info['title']))
  895.                    
  896.                     await asyncio.sleep(info['duration'])
  897.                     cp[message.server.id] = 'False'
  898.                     playlist[message.server.id] = playlist[message.server.id][len(urllist)+7:]
  899.                     await music_playlist(message)
  900.                    
  901.             except Exception as e:
  902.                 e = sys.exc_info()[0]
  903.                 await client.send_message(message.server, "Error2____[{0}]".format(e))
  904.  
  905.         if not client.is_voice_connected(message.server):
  906.             try:
  907.                 while playlist[message.server.id] != '':
  908.                     urllist = playlist[message.server.id].split('<split>')
  909.  
  910.                     channel = message.author.voice.voice_channel
  911.                     vc = await client.join_voice_channel(channel)
  912.                     musicplayer = await vc.create_ytdl_player(url, before_options=" -reconnect 1 -reconnect_streamed 1"
  913.                                                                                    " -reconnect_delay_max 5")
  914.                     players[message.server.id] = musicplayer
  915.                     musicplayer.start()
  916.                     cp[message.server.id] = 'True'
  917.                    
  918.                     info = ytdl.extract_info(url, download = False)
  919.                     formats = info['formats']
  920.                     msg = 'Currently playing: {0}'.format()
  921.                     print('Playing {0}\n'.format(info['title']))
  922.                    
  923.                     await asyncio.sleep(info['duration'])
  924.                     cp[message.server.id] = 'False'
  925.                     playlist[message.server.id] = playlist[message.server.id][len(urllist)+7:]
  926.                     await music_playlist(message)      
  927.                    
  928.                    
  929.             except Exception as e:
  930.                 e = sys.exc_info()[0]
  931.                 await client.send_message(message.channel, "Error3____[{0}]".format(e))
  932.                
  933.     except Exception as e:
  934.         e = sys.exc_info()[0]
  935.         #await client.send_message(message.channel, "Error4____[{0}]".format(e))
  936.         print("Error4____[{0}]".format(e))
  937.    
  938.  
  939.  
  940. statuses = ["with Lily", "with Ana", "with Yuno", "with Eri", "with Honoka", "with Nico", "with Nico", "with Nico Nico Niii~",
  941.             "with Maki", "with herself", "with her toys", "with Nozomi", "with Kotori", "with Umi", "with Rin", "with Hanayo",
  942.             "with Chika", "with Riko", "with Kanan", "with Dia", "with You-chan", "with Yoshiko", "with Yohanne", "with Hanamaru zuraaa~",
  943.             "with Mari", "with Ruby", "with Taiga", "with her phone", "with Toastie", "with daddy Ado", "with adorable Ana-chan",
  944.             "with Mashiro", "with Yuzu", "with Katalina", "with her creator", "with Angela", "with her hair", "with Aqours", "with ยต's",
  945.             "with Luka", "Doki Doki Literature Club", "with Natsuki..?", "with Yuri", "with Sayori", "with Hana", "with her friends",
  946.             "with Faerlynn", "nothing... Weird...", "with Satou", "with Shio", "with Livvy", "as Mercy", "as Ana", "as Brigitte", "as Pharah", "as D.Va",
  947.             "as Mei", "as Sombra", "as Ashe", "as Moira", "as Symmetra", "as Tracer", "as Zarya", "as Miku", "as Luka", "as Athena", "as Echo",
  948.             "as Efi", "with Katniss"]
  949.  
  950.  
  951. async def task_loop():
  952.     while True:
  953.         me = discord.utils.find(lambda s: s != None, client.servers).me
  954.         if not me:
  955.                 return
  956.         elif not me.game:
  957.                 updated_game = discord.Game(name = random.choice(statuses))
  958.         else:
  959.                 updated_game = me.game
  960.                 updated_game.name = random.choice(statuses)
  961.         await client.change_presence(game = updated_game)
  962.         print('Setting game to: Playing {0}'.format(str(updated_game)))
  963.         await asyncio.sleep(300)
  964.  
  965.  
  966. @client.event
  967. async def on_ready():
  968.     global start, statuses
  969.     print('Logged in as:', client.user.name)
  970.     print('Client ID:',client.user.id)
  971.     print('Loading files...')
  972.     reload_files()
  973.     if success == False:
  974.         print('Files loaded successfully')
  975.     else:
  976.         print("Loading of files unsuccessfull")
  977.     end = timeit.timeit()
  978.     print('Started up in', round((end - start)*100, 2), 'seconds')
  979.     client.loop.create_task(task_loop())
  980.     await asyncio.sleep(0.5)
  981.     print('------------')
  982.  
  983. TOKEN = '<removed>'      
  984. client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement