Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 9th, 2020 184 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. botprefixes = ("?", "!", "/")
  2. client = Bot(command_prefix = botprefixes, case_insensitive=True)
  3. client.remove_command('help')
  4. voicechannelid = 691284883619709102
  5. def getaudio():
  6.     #Getting all sounds
  7.     allsounds = [sound for sound in os.walk('sounds')]
  8.     allsounds.pop(0)
  9.     sounds = {}
  10.     uncategorizedsounds = {}
  11.     for soundfolder in allsounds:
  12.         foldername = soundfolder[0].split(os.sep)[-1]
  13.         sounds[foldername]=[]
  14.         for sound in soundfolder[2]:
  15.             soundname = sound.replace('.mp3','')
  16.             soundpath = os.path.join(foldername,sound)
  17.             #makes the path work on windows
  18.             if soundpath[0:6] != 'sounds':
  19.                 soundpath = os.path.join('sounds',soundpath)
  20.             sounds[foldername].append(soundpath)
  21.             uncategorizedsounds[soundname]=soundpath
  22.     #Creating help command message
  23.     helpmessage = 'Lista cu sunete, toate se scriu dupa comanda !franku\n\n'
  24.     for folder in list(sounds.keys()):
  25.         helpmessage+='{0} - sunet random cu {0}\n'.format(folder)
  26.         for audio in sounds[folder]:
  27.             audioname = audio.split(os.sep)[-1].replace('.mp3','')
  28.             helpmessage+='    {0}\n'.format(audioname)
  29.         helpmessage+='\n'
  30.     helpmessage+='\n!ho, !stop - il opreste'
  31.     return(sounds,uncategorizedsounds,helpmessage)
  32.  
  33. @client.event
  34. async def on_ready():
  35.     await client.change_presence(activity=discord.Game(name='PinkGuy Simulator'))
  36.     print("Logged in as " + client.user.name)
  37.     voicechannel = client.get_channel(voicechannelid) #get voice channel
  38.     Voiceclient = await voicechannel.connect() # connect to voice channel
  39.     sounddata = getaudio()
  40.     Voiceclient.sounds = sounddata[0]
  41.     Voiceclient.uncategorizedsounds = sounddata[1]
  42.     Voiceclient.helpmessage = sounddata[2]
  43.  
  44. #If an unrecognized command is used stops from giving out an error
  45. @client.event
  46. async def on_command_error(context, error):
  47.     if isinstance(error, CommandNotFound):
  48.         return
  49.     raise error
  50.  
  51. @client.command()
  52. async def franku(context,*argument):
  53.     voice = context.voice_client
  54.     if not argument:
  55.         mp3name = choice(list(voice.uncategorizedsounds.keys()))
  56.         mp3 = voice.uncategorizedsounds[mp3name]
  57.     elif argument[0].lower() in list(voice.sounds.keys()):
  58.         mp3 = choice(voice.sounds[argument[0].lower()])
  59.     elif argument[0].lower() in list(voice.uncategorizedsounds.keys()):
  60.         mp3 = voice.uncategorizedsounds[argument[0].lower()]
  61.     elif argument[0].lower() == 'reload':
  62.         sounddata = getaudio()
  63.         voice.sounds = sounddata[0]
  64.         voice.uncategorizedsounds = sounddata[1]
  65.         voice.helpmessage = sounddata[2]
  66.         await context.send('Sounds loaded')
  67.         return
  68.     else:
  69.         print('audio "{0}" not found'.format(argument[0].lower()))
  70.         return
  71.     if voice.is_playing():
  72.         voice.stop()
  73.     audio = discord.FFmpegPCMAudio(mp3,executable=FfmpegPath)
  74.     voice.play(audio)
  75.  
  76. @client.command(aliases=['ho'])
  77. async def stop(context):
  78.     voice = context.voice_client
  79.     if voice.is_playing():
  80.         voice.stop()
  81.  
  82. @client.command()
  83. async def sunete(context):
  84.     voice = context.voice_client
  85.     await context.send(voice.helpmessage)
  86. config = configparser.ConfigParser()
  87. config.read('frankubot.ini')
  88. FfmpegPath = config['FRANKUBOT']['FfmpegPath']
  89. client.run(BOTTOKEN)
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
Top