Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
2,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.16 KB | None | 0 0
  1. import discord
  2. import random
  3. from discord.ext import commands
  4. from discord.utils import get
  5. import os
  6. import youtube_dl
  7. import sys
  8. from os import system
  9. import shutil
  10. import time
  11.  
  12. bot = commands.Bot(command_prefix='.')
  13. BOT_PREFIX = '.'
  14.  
  15.  
  16. @bot.event
  17. async def on_ready():
  18. await bot.change_presence(status=discord.Status.online, activity=discord.Game("Burning"))
  19. print("Bot is ready")
  20.  
  21.  
  22. @bot.event
  23. async def on_member_join(member):
  24. print(f"{member} joined the channel")
  25. await ctx.send("f{member} joined the channel")
  26.  
  27.  
  28. @bot.event
  29. async def on_member_remove(member):
  30. print(f"{member} Left the server")
  31.  
  32.  
  33. @bot.command(aliases=("8ball", "8ballzz"))
  34. async def ask(ctx, *, question):
  35. responses = ("C'est certain",
  36. "Cela ne fait aucun doute",
  37. "Oof,je n'ai pas compris",
  38. "Bien sur",
  39. "Oui",
  40. "J'imagine",)
  41. await ctx.send(f"Question: {question}\nAnswer: {random.choice(responses)} ")
  42.  
  43.  
  44. @bot.command()
  45. @commands.has_role("Moderateur")
  46. async def kick(ctx, member: discord.Member, *, reason=None):
  47. await member.kick(reason=reason)
  48.  
  49.  
  50. @bot.command()
  51. @commands.has_role("Moderateur")
  52. async def ban(ctx, member: discord.Member, *, reason=None):
  53. await member.ban(reason=reason)
  54.  
  55.  
  56. @bot.command()
  57. @commands.has_role("Moderateur")
  58. async def unban(ctx, *, member):
  59. banned_users = await ctx.guild.bans()
  60. member_name, member_discriminator = member.split("#")
  61.  
  62. for ban_entry in banned_users:
  63. user = ban_entry.user
  64.  
  65. if (user.name, user.discriminator) == (member_name, member_discriminator):
  66. await ctx.guild.unban(user)
  67. await ctx.send(f"Unbanned {user.name}#{user.discriminator} ")
  68.  
  69.  
  70. bot = commands.Bot(command_prefix=BOT_PREFIX)
  71.  
  72.  
  73. @bot.event
  74. async def on_ready():
  75. await bot.change_presence(status=discord.Status.online, activity=discord.Game(".help for commands"))
  76. print("Logged in as: " + bot.user.name + "\n")
  77.  
  78.  
  79. @bot.command(pass_context=True, aliases=['j', 'joi'])
  80. async def join(ctx):
  81. global voice
  82. channel = ctx.message.author.voice.channel
  83. voice = get(bot.voice_clients, guild=ctx.guild)
  84.  
  85. if voice and voice.is_connected():
  86. await voice.move_to(channel)
  87. else:
  88. voice = await channel.connect()
  89.  
  90. await voice.disconnect()
  91.  
  92. if voice and voice.is_connected():
  93. await voice.move_to(channel)
  94. else:
  95. voice = await channel.connect()
  96. print(f"The bot has connected to {channel}\n")
  97.  
  98. await ctx.send(f"Joined {channel}")
  99.  
  100.  
  101. @bot.command(pass_context=True, aliases=['l', 'lea'])
  102. async def leave(ctx):
  103. channel = ctx.message.author.voice.channel
  104. voice = get(bot.voice_clients, guild=ctx.guild)
  105.  
  106. if voice and voice.is_connected():
  107. await voice.disconnect()
  108. print(f"The bot has left {channel}")
  109. await ctx.send(f"Left {channel}")
  110. else:
  111. print("Bot was told to leave voice channel, but was not in one")
  112. await ctx.send("Don't think I am in a voice channel")
  113.  
  114.  
  115. @bot.command(pass_context=True, aliases=['p', 'pla'])
  116. async def play(ctx, url: str):
  117. def check_queue():
  118. Queue_infile = os.path.isdir("./Queue")
  119. if Queue_infile is True:
  120. DIR = os.path.abspath(os.path.realpath("Queue"))
  121. length = len(os.listdir(DIR))
  122. still_q = length - 1
  123. try:
  124. first_file = os.listdir(DIR)[0]
  125. except:
  126. print("No more queued song(s)\n")
  127. queues.clear()
  128. return
  129. main_location = os.path.dirname(os.path.realpath(__file__))
  130. song_path = os.path.abspath(os.path.realpath("Queue") + "\\" + first_file)
  131. if length != 0:
  132. print("Song done, playing next queued\n")
  133. print(f"Songs still in queue: {still_q}")
  134. song_there = os.path.isfile("song.mp3")
  135. if song_there:
  136. os.remove("song.mp3")
  137. shutil.move(song_path, main_location)
  138. for file in os.listdir("./"):
  139. if file.endswith(".mp3"):
  140. os.rename(file, 'song.mp3')
  141.  
  142. voice.play(discord.FFmpegPCMAudio("song.mp3"), after=lambda e: check_queue())
  143. voice.source = discord.PCMVolumeTransformer(voice.source)
  144. voice.source.volume = 0.70
  145.  
  146. else:
  147. queues.clear()
  148. return
  149.  
  150. else:
  151. queues.clear()
  152. print("No songs were queued before the ending of the last song\n")
  153.  
  154. song_there = os.path.isfile("song.mp3")
  155. try:
  156. if song_there:
  157. os.remove("song.mp3")
  158. queues.clear()
  159. print("Removed old song file")
  160. except PermissionError:
  161. print("Trying to delete song file, but it's being played")
  162. await ctx.send("ERROR: Music playing")
  163. return
  164.  
  165. Queue_infile = os.path.isdir("./Queue")
  166. try:
  167. Queue_folder = "./Queue"
  168. if Queue_infile is True:
  169. print("Removed old Queue Folder")
  170. shutil.rmtree(Queue_folder)
  171. except:
  172. print("No old Queue folder")
  173.  
  174. await ctx.send("Getting everything ready now")
  175.  
  176. voice = get(bot.voice_clients, guild=ctx.guild)
  177.  
  178. ydl_opts = {
  179. 'format': 'bestaudio/best',
  180. 'quiet': True,
  181. 'postprocessors': [{
  182. 'key': 'FFmpegExtractAudio',
  183. 'preferredcodec': 'mp3',
  184. 'preferredquality': '192',
  185. }],
  186. }
  187. try:
  188. with youtube_dl.YoutubeDL(ydl_opts) as ydl:
  189. print("Downloading audio now\n")
  190. ydl.download([url])
  191. except:
  192. print("FALLBACK: youtube-dl does not support this URL, using Spotify (This is normal if Spotify URL)")
  193. c_path = os.path.dirname(os.path.realpath(__file__))
  194. system("spotdl -f " + '"' + c_path + '"' + " -s " + url)
  195.  
  196. for file in os.listdir("./"):
  197. if file.endswith(".mp3"):
  198. name = file
  199. print(f"Renamed File: {file}\n")
  200. os.rename(file, "song.mp3")
  201.  
  202. voice.play(discord.FFmpegPCMAudio("song.mp3"), after=lambda e: check_queue())
  203. voice.source = discord.PCMVolumeTransformer(voice.source)
  204. voice.source.volume = 0.07
  205.  
  206. # this is not needed code that I added and later removed, it will cause an error if the name
  207. # of the song does not have an - in it you can delete it or put it in a try block
  208.  
  209. #nname = name.rsplit("-", 2)
  210. #await ctx.send(f"Playing: {nname[0]}")
  211. #print("playing\n")
  212.  
  213.  
  214. @bot.command(pass_context=True, aliases=['pa', 'pau'])
  215. async def pause(ctx):
  216. voice = get(bot.voice_clients, guild=ctx.guild)
  217.  
  218. if voice and voice.is_playing():
  219. print("Music paused")
  220. voice.pause()
  221. await ctx.send("Music paused")
  222. else:
  223. print("Music not playing failed pause")
  224. await ctx.send("Music not playing failed pause")
  225.  
  226.  
  227. @bot.command(pass_context=True, aliases=['r', 'res'])
  228. async def resume(ctx):
  229. voice = get(bot.voice_clients, guild=ctx.guild)
  230.  
  231. if voice and voice.is_paused():
  232. print("Resumed music")
  233. voice.resume()
  234. await ctx.send("Resumed music")
  235. else:
  236. print("Music is not paused")
  237. await ctx.send("Music is not paused")
  238.  
  239.  
  240. @bot.command(pass_context=True, aliases=['s', 'sto'])
  241. async def stop(ctx):
  242. voice = get(bot.voice_clients, guild=ctx.guild)
  243.  
  244. queues.clear()
  245.  
  246. queue_infile = os.path.isdir("./Queue")
  247. if queue_infile is True:
  248. shutil.rmtree("./Queue")
  249.  
  250. if voice and voice.is_playing():
  251. print("Music stopped")
  252. voice.stop()
  253. await ctx.send("Music stopped")
  254. else:
  255. print("No music playing failed to stop")
  256. await ctx.send("No music playing failed to stop")
  257.  
  258.  
  259. queues = {}
  260.  
  261.  
  262. @bot.command(pass_context=True, aliases=['q', 'que'])
  263. async def queue(ctx, url: str):
  264. Queue_infile = os.path.isdir("./Queue")
  265. if Queue_infile is False:
  266. os.mkdir("Queue")
  267. DIR = os.path.abspath(os.path.realpath("Queue"))
  268. q_num = len(os.listdir(DIR))
  269. q_num += 1
  270. add_queue = True
  271. while add_queue:
  272. if q_num in queues:
  273. q_num += 1
  274. else:
  275. add_queue = False
  276. queues[q_num] = q_num
  277.  
  278. queue_path = os.path.abspath(os.path.realpath("Queue") + f"\song{q_num}.%(ext)s")
  279.  
  280. ydl_opts = {
  281. 'format': 'bestaudio/best',
  282. 'quiet': True,
  283. 'outtmpl': queue_path,
  284. 'postprocessors': [{
  285. 'key': 'FFmpegExtractAudio',
  286. 'preferredcodec': 'mp3',
  287. 'preferredquality': '192',
  288. }],
  289. }
  290. try:
  291. with youtube_dl.YoutubeDL(ydl_opts) as ydl:
  292. print("Downloading audio now\n")
  293. ydl.download([url])
  294. except:
  295. print("FALLBACK: youtube-dl does not support this URL, using Spotify (This is normal if Spotify URL)")
  296. q_path = os.path.abspath(os.path.realpath("Queue"))
  297. system(f"spotdl -ff song{q_num} -f " + '"' + q_path + '"' + " -s " + url)
  298.  
  299. await ctx.send("Adding song " + str(q_num) + " to the queue")
  300.  
  301. print("Song added to queue\n")
  302.  
  303.  
  304. @bot.command(pass_context=True, aliases=['n', 'nex'])
  305. async def next(ctx):
  306. voice = get(bot.voice_clients, guild=ctx.guild)
  307.  
  308. if voice and voice.is_playing():
  309. print("Playing Next Song")
  310. voice.stop()
  311. await ctx.send("Next Song")
  312. else:
  313. print("No music playing")
  314. await ctx.send("No music playing failed")
  315.  
  316.  
  317. @bot.command()
  318. async def eef(ctx, *, arg):
  319. await ctx.send(arg)
  320.  
  321.  
  322. @bot.command(aliases=("eefing", "goofing",))
  323. async def eefedup(ctx):
  324. voice = get(bot.voice_clients, guild=ctx.guild)
  325. voice.play(discord.FFmpegPCMAudio("oofedup.mp4"), after=lambda e: print("Song done!"))
  326. voice.source = discord.PCMVolumeTransformer(voice.source)
  327. voice.source.volume = 0.18
  328. song_there = os.path.isfile("oofedup.mp4")
  329.  
  330.  
  331. @bot.command()
  332. async def rayan(ctx):
  333. await ctx.send("Mister GAY, aka mister smash my keyboard at 7h du mat pcq jai pas de vie, jveux aller au cfp des riveshit mais je reussirai jamais pcq je suis un sale dweeb sans avenir")
  334.  
  335.  
  336. @bot.command(aliases=("muffing", "moof",))
  337. async def muffin(ctx):
  338. voice = get(bot.voice_clients, guild=ctx.guild)
  339. voice.play(discord.FFmpegPCMAudio("muffin.mp4"), after=lambda e: print("Song done!"))
  340. voice.source = discord.PCMVolumeTransformer(voice.source)
  341. voice.source.volume = 0.30
  342. song_there = os.path.isfile("muffin.mp4")
  343.  
  344.  
  345. @bot.command(aliases=("oofedupboosted", "eefingupboosted",))
  346. async def oofedupboost(ctx):
  347. voice = get(bot.voice_clients, guild=ctx.guild)
  348. voice.play(discord.FFmpegPCMAudio("oofedupboosted.mp4"), after=lambda e: print("Song done!"))
  349. voice.source = discord.PCMVolumeTransformer(voice.source)
  350. voice.source.volume = 0.09
  351. song_there = os.path.isfile("oofedupboosted.mp4")
  352.  
  353.  
  354. @bot.command(aliases=("muffinboosted", "m00f",))
  355. async def muffinboost(ctx):
  356. voice = get(bot.voice_clients, guild=ctx.guild)
  357. voice.play(discord.FFmpegPCMAudio("muffinboost.mp4"), after=lambda e: print("Song done!"))
  358. voice.source = discord.PCMVolumeTransformer(voice.source)
  359. voice.source.volume = 0.7
  360. song_there = os.path.isfile("muffinboost.mp4")
  361.  
  362.  
  363. @bot.command()
  364. async def fab(ctx):
  365. await ctx.send("Oofed on genoux, Mister entorse gang")
  366.  
  367.  
  368. @bot.command()
  369. async def youry(ctx):
  370. await ctx.send("Je dois ma vie a Youry, mon createur. C'est un shot-creator avec tous ses badges HOF, please love him, ty.")
  371.  
  372.  
  373. @bot.command()
  374. async def junior(ctx):
  375. await ctx.send("I'm a gay nibber soumis a une 4'11 white thot xddd pls give pc thx")
  376.  
  377. @bot.command(aliases=("nerfed", "nerfit", ))
  378. async def nerf(ctx):
  379. voice = get(bot.voice_clients, guild=ctx.guild)
  380. voice.play(discord.FFmpegPCMAudio("nerfthis.mp4"), after=lambda e: print("Song done!"))
  381. voice.source = discord.PCMVolumeTransformer(voice.source)
  382. voice.source.volume = 0.7
  383. song_there = os.path.isfile("nerfthis.mp4")
  384.  
  385. @bot.command(pass_context=True)
  386. async def ping(ctx):
  387.  
  388. before = time.monotonic()
  389. message = await ctx.send("Pong!")
  390. ping = (time.monotonic() - before) * 1000
  391. await message.edit(content=f"Pong! `{int(ping)}ms`")
  392. print(f'Ping {int(ping)}ms')
  393.  
  394. @bot.command(aliases=("dancing", "dance", ))
  395. async def dancin(ctx):
  396. voice = get(bot.voice_clients, guild=ctx.guild)
  397. voice.play(discord.FFmpegPCMAudio("dance.mp4"), after=lambda e: print("Song done!"))
  398. voice.source = discord.PCMVolumeTransformer(voice.source)
  399. voice.source.volume = 0.7
  400. song_there = os.path.isfile("dance.mp4")
  401.  
  402. @bot.command(aliases=("sunsetter", "cookie", ))
  403. async def sunset(ctx):
  404. voice = get(bot.voice_clients, guild=ctx.guild)
  405. voice.play(discord.FFmpegPCMAudio("sunsetter.mp4"), after=lambda e: print("Song done!"))
  406. voice.source = discord.PCMVolumeTransformer(voice.source)
  407. voice.source.volume = 0.7
  408. song_there = os.path.isfile("sunsetter.mp4")
  409.  
  410. @bot.command(aliases=("eiffel", "oofinz", ))
  411. async def blue(ctx):
  412. voice = get(bot.voice_clients, guild=ctx.guild)
  413. voice.play(discord.FFmpegPCMAudio("eiffel.mp4"), after=lambda e: print("Song done!"))
  414. voice.source = discord.PCMVolumeTransformer(voice.source)
  415. voice.source.volume = 0.7
  416. song_there = os.path.isfile("eiffel.mp4")
  417.  
  418. @bot.command(aliases=("rounde", "loaded", ))
  419. async def dex(ctx):
  420. voice = get(bot.voice_clients, guild=ctx.guild)
  421. voice.play(discord.FFmpegPCMAudio("unarmed.mp4"), after=lambda e: print("Song done!"))
  422. voice.source = discord.PCMVolumeTransformer(voice.source)
  423. voice.source.volume = 0.7
  424. song_there = os.path.isfile("unarmed.mp4")
  425.  
  426. @bot.command(aliases=("rounded", "kuso", ))
  427. async def roundz(ctx):
  428. voice = get(bot.voice_clients, guild=ctx.guild)
  429. voice.play(discord.FFmpegPCMAudio("round2.mp4"), after=lambda e: print("Song done!"))
  430. voice.source = discord.PCMVolumeTransformer(voice.source)
  431. voice.source.volume = 0.7
  432. song_there = os.path.isfile("round2.mp4")
  433.  
  434. @bot.command(aliases=("diamondz", "craftgang", ))
  435. async def diamond(ctx):
  436. voice = get(bot.voice_clients, guild=ctx.guild)
  437. voice.play(discord.FFmpegPCMAudio("diamond.mp4"), after=lambda e: print("Song done!"))
  438. voice.source = discord.PCMVolumeTransformer(voice.source)
  439. voice.source.volume = 0.7
  440. song_there = os.path.isfile("diamond.mp4")
  441.  
  442. @bot.command(aliases=("Oofingzs", "creek", ))
  443. async def oof(ctx):
  444. voice = get(bot.voice_clients, guild=ctx.guild)
  445. voice.play(discord.FFmpegPCMAudio("oofing.mp4"), after=lambda e: print("Song done!"))
  446. voice.source = discord.PCMVolumeTransformer(voice.source)
  447. voice.source.volume = 0.7
  448. song_there = os.path.isfile("oofing.mp4")
  449.  
  450. @bot.command(aliases=("Oofingz", "cree", ))
  451. async def eefed(ctx):
  452. voice = get(bot.voice_clients, guild=ctx.guild)
  453. voice.play(discord.FFmpegPCMAudio("earrape.mp4"), after=lambda e: print("Song done!"))
  454. voice.source = discord.PCMVolumeTransformer(voice.source)
  455. voice.source.volume = 0.7
  456. song_there = os.path.isfile("earrape.mp4")
  457.  
  458. @bot.command()
  459. async def slut(ctx, member: discord.Member):
  460. await ctx.send(f"{member}, oh yeah I'm your slut 👅💦")
  461.  
  462. @bot.command()
  463. async def nic(ctx):
  464. await ctx.send("Mid-Range Dead-Eye Hall Of Fame Worthy Holder, Mister Bball coach")
  465.  
  466. @bot.command()
  467. async def younes(ctx):
  468. await ctx.send("Mister ma mom ma foutue dehors de chez moi et veux me foutre en cours, AKA mister wanna be OG, i flex up que jetais la pendant 7 ans mais en realiter jai ete aussi present que mon pere, c'est a dire jamais la OOF")
  469.  
  470. @bot.command()
  471. async def leajade(ctx):
  472. await ctx.send("Je sUiS fIdElE, J'Me SuiS jUStE prIS dEux bIG bLAcKS cOCKs eN MeME tEmPs HeHEhe, MaIs c RiEn")
  473.  
  474. @bot.command()
  475. async def carolanne(ctx):
  476. await ctx.send("4'11 bitch jumps from bbc to small chinese cock, esti de dumb fuck, son cerveau s'est fait fucking whip par tizzo pour avoir un QI aussi merdique.")
  477.  
  478. @bot.command()
  479. async def pascal(ctx):
  480. await ctx.send("Took a cock 5 inch in the ass but still cool.")
  481.  
  482.  
  483. @bot.command()
  484. async def disscaro(ctx):
  485. await ctx.send("*Insert your favorite rap beat*")
  486. time.sleep(2)
  487. await ctx.send("Ok, ok")
  488. time.sleep(2)
  489. await ctx.send("Carolanne est une salope, hey.")
  490. time.sleep(2)
  491. await ctx.send("Elle a pris une pente,")
  492. time.sleep(2)
  493. await ctx.send("from black to slack *OOF*")
  494. time.sleep(2)
  495. await ctx.send("Joon gang a un ptite dick")
  496. time.sleep(2)
  497. await ctx.send("Junior a dit qu'elle sait pas lick")
  498. time.sleep(2)
  499. await ctx.send("Verse 2:")
  500. time.sleep(2)
  501. await ctx.send("Leajade et elle, duo dynamique")
  502. time.sleep(2)
  503. await ctx.send("Pas plus grosses thots qu'eux deux.")
  504. time.sleep(2)
  505. await ctx.send("Elles ont sucer et pas qu'un peu *ZOW*")
  506. time.sleep(2)
  507. await ctx.send("elles s'aiment se frotter sur des queues *EEF*")
  508. time.sleep(2)
  509. await ctx.send("que des facts, back to back")
  510. time.sleep(2)
  511. await ctx.send("Akasuki on the beat")
  512. time.sleep(2)
  513. await ctx.send("hmu si tu veux un feat.")
  514. time.sleep(2)
  515. await ctx.send("Zow.")
  516.  
  517. @bot.command
  518. async def dissleajade(ctx)
  519. await ctx.send("*Insert your favorite rap beat*")
  520. time.sleep(2)
  521. await ctx.send("Leajade elle est bad")
  522. time.sleep(2)
  523. await ctx.send("elle suce pour des CAD *WOW*")
  524. time.sleep(2)
  525. await ctx.send("Oui c'est une salope")
  526. time.sleep(2)
  527. await ctx.send("Elle adore checker des top *FACTS*")
  528. time.sleep(2)
  529. await ctx.send("Mon nom c'est Akasuki *Ok*")
  530. time.sleep(2)
  531. await ctx.send("Leajade aime que les gros zizis")
  532. time.sleep(2)
  533. await ctx.send("Moi j'aurai pas pris.")
  534. time.sleep(2)
  535. await ctx.send("Tout le monde ce l'est tapper.")
  536. time.sleep(2)
  537. await ctx.send("Meme si je l'aurai violer, elle aurait apprecier *kiettt*")
  538. time.sleep(2)
  539. await ctx.send("F-fuck lea-quoi?")
  540. time.sleep(2)
  541. await ctx.send("Lea-BITCH.")
  542. time.sleep(2)
  543. await ctx.send("Derniere petite question....")
  544. time.sleep(2)
  545. await ctx.send("Est-ce que tu te rappelles de mon nom?")
  546. time.sleep(2)
  547. await ctx.send("Akasuki, créée par Youry. *DAMN*")
  548.  
  549.  
  550.  
  551.  
  552.  
  553. bot.run("NjAyNDAxOTM1NTk2ODQ3MTA1.XTU1Yg.6jDhFJE7TjRCF-D02ViYqIJrF7Y")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement