[fractale module] added von_kock and blanc_manger
This commit is contained in:
parent
b8926d4265
commit
28f7e0ea1d
@ -1,8 +1,9 @@
|
|||||||
#dummy module
|
#dummy module
|
||||||
import asyncio
|
import asyncio
|
||||||
import fractale.source.betterTurtle
|
import fractale.source.main
|
||||||
import random
|
import random
|
||||||
import discord
|
import discord
|
||||||
|
from PIL import Image
|
||||||
class MainClass():
|
class MainClass():
|
||||||
def __init__(self, client, modules, owners, prefix):
|
def __init__(self, client, modules, owners, prefix):
|
||||||
self.client = client
|
self.client = client
|
||||||
@ -17,13 +18,29 @@ class MainClass():
|
|||||||
self.interactive=True
|
self.interactive=True
|
||||||
self.color=0x78ffc3
|
self.color=0x78ffc3
|
||||||
self.help="""\
|
self.help="""\
|
||||||
</prefix>fractale
|
</prefix>fractale [fractale] [nombre d'itérations]
|
||||||
=> Génère une image fractale.
|
=> Génère une image fractale. (Si on met le nombre d'itérations, on doit mettre le nom de la fractale.)
|
||||||
|
|
||||||
|
[fractale]
|
||||||
|
...: von_koch
|
||||||
|
...: blanc_manger
|
||||||
"""
|
"""
|
||||||
async def on_message(self, message):
|
async def on_message(self, message):
|
||||||
|
args=message.content.split(" ")
|
||||||
tmpstr="/tmp/%s.png"%random.randint(1,10000000)
|
tmpstr="/tmp/%s.png"%random.randint(1,10000000)
|
||||||
t = fractale.source.betterTurtle.Turtle(size=(10000, 10000), resolution=1)
|
im=Image.new('RGB', (5000, 5000), (0, 0, 0))
|
||||||
t.set_position((0, 0))
|
fig = fractale.source.main.Figures(im=im)
|
||||||
t.fractal.outline(8, 40, 4)
|
if len(args)==1 :
|
||||||
t.save(tmpstr)
|
fig.von_koch_curve_flake((2500, 2500), 2000, 5)
|
||||||
|
elif args[1].lower()=="blanc_manger" :
|
||||||
|
iterations=7
|
||||||
|
if len(args)>2 and int(args[2])<=20:
|
||||||
|
iterations=int(args[2])
|
||||||
|
fig.blanc_manger((1000, 1000), (4000, 4000), iterations)
|
||||||
|
elif args[1].lower()=="von_koch" :
|
||||||
|
iterations=5
|
||||||
|
if len(args)>2 and int(args[2])<=7:
|
||||||
|
iterations=int(args[2])
|
||||||
|
fig.von_koch_curve_flake((2500, 2500), 2000, iterations)
|
||||||
|
im.save(tmpstr)
|
||||||
await message.channel.send(file=discord.File(tmpstr))
|
await message.channel.send(file=discord.File(tmpstr))
|
||||||
|
@ -12,7 +12,7 @@ class MainClass():
|
|||||||
self.name="Restart"
|
self.name="Restart"
|
||||||
self.description="Module gérant les redémarrages du bot"
|
self.description="Module gérant les redémarrages du bot"
|
||||||
self.interactive=True
|
self.interactive=True
|
||||||
self.authlist=[549662392120901633]
|
self.authlist=[]
|
||||||
self.color=0x000000
|
self.color=0x000000
|
||||||
self.help="""\
|
self.help="""\
|
||||||
</prefix>restart
|
</prefix>restart
|
||||||
|
Loading…
Reference in New Issue
Block a user