Description: Werner is a Discord bot, that generates graphical transfer updates using the given information.
The player's image
The player's current club
The player's future club (according to the transfer news)
The player's name
The player's age
The deal's current status
- Pillow
- Discord.py
I used Discord.py to lay the code Discord bot functionalities' foundation. It allowed me to login into my Discord bot, take input from users on Discord and then tie those input with my rest of the code
Pillow is the key reason why this bot was possible, Pillow allowed me to take that Discord user's input and combine all of that to produce the final image.
- There's a Files folder
- In which is another folder named Main:
- There resides my bot.py file, the main file
- The base image, using which pillow would work
- A truetype font file, which pillow would use to type text on the image.
- An image file named generated_image, this is the image that pillow produced
- Lastly there's another folder image:
- Where lies all the downloaded images from user's input
- In which is another folder named Main:
- To connect the code to Discord's portal, making the bot and taking in input etc
- Image manipulation, the juicy part
-
- In this bit,
- I connect my code to the Discord portal through the given token
- Ask for user input
- Make embeds, stylised messages of Discord
- Store those user input in a variable
- Send the produced image on Discord
-
- Here using the pillow module,
- I open the base image, and user's inputted images
- Convert the png files of the user to the RGBA mode
- Paste those images on the base image
- Write text on the image according to the user's text-replies
- Save the produced image and forward it to Discord.py
- First of all, type
.transfer player_name
where player_name is the name of the player for whom you are creating the transfer update. - Then the bot would ask for the player's age, where you would type in the player's age.
- Then the bot would ask you to input an online image of the player
- Then it would ask for an online image of player's current club's logo
- Then it would ask for an online image of the player's future club's logo
- And finally it would prompt you for the transfer's current status.