KiTTY, un bot Discord qui est un petit chat :) Il est basé sur une ancienne version du bot Red, sous Python 3.6 et qui a des fonctionnalités bien sympatiques !
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

59 lines
1.9 KiB

  1. import discord
  2. import pyfiglet
  3. import requests
  4. import random
  5. from discord.ext import commands
  6. from cogs.utils import checks
  7. from random import randint
  8. from random import choice
  9. from cogs.utils.chat_formatting import box
  10. from bs4 import BeautifulSoup
  11. class Fun:
  12. """docstring for fun"""
  13. def __init__(self, bot):
  14. self.bot = bot
  15. self.nsword = 0
  16. @commands.command(pass_context=True)
  17. async def swordbattle(self, ctx, *, user: discord.Member):
  18. """Sword Duel!"""
  19. author = ctx.message.author
  20. self.nsword += 1
  21. n = self.nsword
  22. if user.id == self.bot.user.id:
  23. await self.bot.say("I'm a cat ! Not a fighting guy !")
  24. else:
  25. await self.bot.say(author.mention + " and " + user.mention + " dueled for " + str(randint(1, 120)) +
  26. " hours! It was a long, heated battle, but " +
  27. choice([author.mention, user.mention]) + " is victorious !")
  28. @commands.command(pass_context=True)
  29. async def cookie(self, ctx, *, user: discord.Member):
  30. """Give some cookie to a people!"""
  31. author = ctx.message.author
  32. if user.id == self.bot.user.id:
  33. await self.bot.say("Thank you :3 !")
  34. else:
  35. await self.bot.say(author.mention + " gave a :cookie: to " + user.mention + " :cat:")
  36. @commands.command(pass_context=True)
  37. async def heart(self, ctx, *, user: discord.Member):
  38. """<3"""
  39. author = ctx.message.author
  40. user.id == self.bot.user.id
  41. await self.bot.say(":heart: " + user.mention)
  42. @commands.command(pass_context=True)
  43. async def arduino(self):
  44. """We're loving arduino"""
  45. source = requests.Session().get("https://www.hackster.io/arduino/projects", headers={"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"}).content
  46. soup = BeautifulSoup(source, "html.parser")
  47. lst = soup.find_all("div", class_="project_card__body__S0LrW cards__body__3yUOQ")
  48. print(lst)
  49. arduino = "https://www.hackster.io/" + random.choice(lst).string
  50. await self.bot.say(arduino)
  51. def setup(bot):
  52. bot.add_cog(Fun(bot))