Merge branch 'master' of https://github.com/Phxntxm/Bonfire
2
.gitignore
vendored
|
@ -8,7 +8,7 @@ GitAutoDeploy.conf.json
|
||||||
.htaccess
|
.htaccess
|
||||||
autoupdate.php
|
autoupdate.php
|
||||||
error_log
|
error_log
|
||||||
images/*
|
images/banner/tmp/*
|
||||||
.ftpquota
|
.ftpquota
|
||||||
bonfire.log
|
bonfire.log
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
|
|
|
@ -8,9 +8,14 @@ https://discordapp.com/oauth2/authorize?client_id=183748889814237186&scope=bot&p
|
||||||
This requires the discord.py library, as well as all of it's dependencies.
|
This requires the discord.py library, as well as all of it's dependencies.
|
||||||
https://github.com/Rapptz/discord.py
|
https://github.com/Rapptz/discord.py
|
||||||
|
|
||||||
I also use the pendulum library, which can be installed using pip.
|
To save the data for the bot, rethinkdb is what is used:
|
||||||
|
https://www.rethinkdb.com/docs/install/
|
||||||
|
|
||||||
|
I also use a few libraries that aren't included by default, which can be installed using pip.
|
||||||
```
|
```
|
||||||
pip install pendulum
|
python3.5 -m pip install rethinkdb pendulum ruamel.yaml Pillow
|
||||||
|
# Or on windows
|
||||||
|
py -3 -m pip install rethinkdb pendulum ruamel.yaml Pillow
|
||||||
```
|
```
|
||||||
|
|
||||||
The only required file to modify would be the config.yml.sample file. The entries are as follows:
|
The only required file to modify would be the config.yml.sample file. The entries are as follows:
|
||||||
|
|
|
@ -86,11 +86,10 @@ class Overwatch:
|
||||||
if data['general_stats'].get('eliminations') and data['general_stats'].get('deaths'):
|
if data['general_stats'].get('eliminations') and data['general_stats'].get('deaths'):
|
||||||
output_data["Kill Death Ratio"] = "{0:.2f}".format(
|
output_data["Kill Death Ratio"] = "{0:.2f}".format(
|
||||||
data['general_stats'].get('eliminations') / data['general_stats'].get('deaths'))
|
data['general_stats'].get('eliminations') / data['general_stats'].get('deaths'))
|
||||||
|
try:
|
||||||
if ctx.message.channel.is_private or ctx.message.channel.permissions_for(ctx.message.server.me).attach_files:
|
|
||||||
banner = await images.create_banner(user, "Overwatch", output_data)
|
banner = await images.create_banner(user, "Overwatch", output_data)
|
||||||
await self.bot.upload(banner)
|
await self.bot.upload(banner)
|
||||||
else:
|
except (FileNotFoundError, discord.Forbidden):
|
||||||
fmt = "\n".join("{}: {}".format(k, r) for k, r in output_data)
|
fmt = "\n".join("{}: {}".format(k, r) for k, r in output_data)
|
||||||
await self.bot.say("Overwatch stats for {}: ```py\n{}```".format(user.name, fmt))
|
await self.bot.say("Overwatch stats for {}: ```py\n{}```".format(user.name, fmt))
|
||||||
|
|
||||||
|
|
|
@ -54,14 +54,14 @@ class Stats:
|
||||||
member_usage = command_stats['member_usage'].get(ctx.message.author.id, 0)
|
member_usage = command_stats['member_usage'].get(ctx.message.author.id, 0)
|
||||||
server_usage = command_stats['server_usage'].get(ctx.message.server.id, 0)
|
server_usage = command_stats['server_usage'].get(ctx.message.server.id, 0)
|
||||||
|
|
||||||
if ctx.message.channel.permissions_for(ctx.message.server.me).attach_files:
|
try:
|
||||||
data = {"Command Name": cmd.qualified_name,
|
data = {"Command Name": cmd.qualified_name,
|
||||||
"Total Usage": total_usage,
|
"Total Usage": total_usage,
|
||||||
"Your Usage": member_usage,
|
"Your Usage": member_usage,
|
||||||
"This Server's Usage": server_usage}
|
"This Server's Usage": server_usage}
|
||||||
banner = await images.create_banner(ctx.message.author, "Command Stats", data)
|
banner = await images.create_banner(ctx.message.author, "Command Stats", data)
|
||||||
await self.bot.upload(banner)
|
await self.bot.upload(banner)
|
||||||
else:
|
except (FileNotFoundError, discord.Forbidden):
|
||||||
fmt = "The command {} has been used a total of {} times\n" \
|
fmt = "The command {} has been used a total of {} times\n" \
|
||||||
"{} times on this server\n" \
|
"{} times on this server\n" \
|
||||||
"It has been ran by you, {}, {} times".format(cmd.qualified_name, total_usage, server_usage,
|
"It has been ran by you, {}, {} times".format(cmd.qualified_name, total_usage, server_usage,
|
||||||
|
@ -89,11 +89,11 @@ class Stats:
|
||||||
# Create a string, each command on it's own line, based on the top 5 used commands
|
# Create a string, each command on it's own line, based on the top 5 used commands
|
||||||
# I'm letting it use the length of the sorted_stats[:5]
|
# I'm letting it use the length of the sorted_stats[:5]
|
||||||
# As this can include, for example, all 3 if there are only 3 entries
|
# As this can include, for example, all 3 if there are only 3 entries
|
||||||
if ctx.message.channel.permissions_for(ctx.message.server.me).attach_files:
|
try:
|
||||||
top_5 = {data[0]: data[1] for data in sorted_stats[:5]}
|
top_5 = {data[0]: data[1] for data in sorted_stats[:5]}
|
||||||
banner = await images.create_banner(ctx.message.author, "Your command usage", top_5)
|
banner = await images.create_banner(ctx.message.author, "Your command usage", top_5)
|
||||||
await self.bot.upload(banner)
|
await self.bot.upload(banner)
|
||||||
else:
|
except (FileNotFoundError, discord.Forbidden):
|
||||||
top_5 = "\n".join("{}: {}".format(data[0], data[1]) for data in sorted_stats[:5])
|
top_5 = "\n".join("{}: {}".format(data[0], data[1]) for data in sorted_stats[:5])
|
||||||
await self.bot.say("Your top {} most used commands are:\n```\n{}```".format(len(sorted_stats[:5]), top_5))
|
await self.bot.say("Your top {} most used commands are:\n```\n{}```".format(len(sorted_stats[:5]), top_5))
|
||||||
elif re.search('server', option):
|
elif re.search('server', option):
|
||||||
|
@ -158,12 +158,12 @@ class Stats:
|
||||||
# Now we only want the first 10 members, so splice this list
|
# Now we only want the first 10 members, so splice this list
|
||||||
sorted_booped_members = sorted_booped_members[:10]
|
sorted_booped_members = sorted_booped_members[:10]
|
||||||
|
|
||||||
if ctx.message.channel.permissions_for(ctx.message.server.me).attach_files:
|
try:
|
||||||
output = {"{0.display_name}".format(ctx.message.server.get_member(m_id)): amt
|
output = {"{0.display_name}".format(ctx.message.server.get_member(m_id)): amt
|
||||||
for m_id, amt in sorted_booped_members}
|
for m_id, amt in sorted_booped_members}
|
||||||
banner = await images.create_banner(ctx.message.author, "Your booped victims", output)
|
banner = await images.create_banner(ctx.message.author, "Your booped victims", output)
|
||||||
await self.bot.upload(banner)
|
await self.bot.upload(banner)
|
||||||
else:
|
except (FileNotFoundError, discord.Forbidden):
|
||||||
output = "\n".join(
|
output = "\n".join(
|
||||||
"{0.display_name}: {1} times".format(ctx.message.server.get_member(m_id), amt) for
|
"{0.display_name}: {1} times".format(ctx.message.server.get_member(m_id), amt) for
|
||||||
m_id, amt in sorted_booped_members)
|
m_id, amt in sorted_booped_members)
|
||||||
|
@ -192,10 +192,10 @@ class Stats:
|
||||||
if count >= 11:
|
if count >= 11:
|
||||||
break
|
break
|
||||||
|
|
||||||
if ctx.message.channel.permissions_for(ctx.message.server.me).attach_files:
|
try:
|
||||||
banner = await images.create_banner(ctx.message.author, "Battling Leaderboard", output)
|
banner = await images.create_banner(ctx.message.author, "Battling Leaderboard", output)
|
||||||
await self.bot.upload(banner)
|
await self.bot.upload(banner)
|
||||||
else:
|
except (FileNotFoundError, discord.Forbidden):
|
||||||
fmt = "\n".join("#{}) {}".format(key, value) for key, value in output.items())
|
fmt = "\n".join("#{}) {}".format(key, value) for key, value in output.items())
|
||||||
await self.bot.say("Battling leaderboard for this server:```\n{}```".format(fmt))
|
await self.bot.say("Battling leaderboard for this server:```\n{}```".format(fmt))
|
||||||
|
|
||||||
|
|
BIN
images/banner/base/bannerBot.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
images/banner/base/bannerTop2.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
images/banner/base/default_avatar.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
images/banner/base/mask.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
images/doggo0.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
images/doggo1.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
images/doggo10.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
images/doggo11.jpg
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
images/doggo12.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
images/doggo13.jpg
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
images/doggo14.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
images/doggo15.jpg
Normal file
After Width: | Height: | Size: 229 KiB |
BIN
images/doggo16.jpg
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
images/doggo17.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
images/doggo18.jpg
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
images/doggo2.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
images/doggo3.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
images/doggo4.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
images/doggo5.jpg
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
images/doggo6.jpg
Normal file
After Width: | Height: | Size: 117 KiB |
BIN
images/doggo7.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
images/doggo8.jpg
Normal file
After Width: | Height: | Size: 169 KiB |
BIN
images/doggo9.jpg
Normal file
After Width: | Height: | Size: 127 KiB |
BIN
images/snek0.jpg
Normal file
After Width: | Height: | Size: 189 KiB |
BIN
images/snek1.jpg
Normal file
After Width: | Height: | Size: 459 KiB |
BIN
images/snek10.jpg
Normal file
After Width: | Height: | Size: 393 KiB |
BIN
images/snek11.jpg
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
images/snek12.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
images/snek13.jpg
Normal file
After Width: | Height: | Size: 214 KiB |
BIN
images/snek14.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
images/snek15.jpg
Normal file
After Width: | Height: | Size: 399 KiB |
BIN
images/snek16.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
images/snek17.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
images/snek18.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
images/snek19.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
images/snek2.jpg
Normal file
After Width: | Height: | Size: 233 KiB |
BIN
images/snek3.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
images/snek4.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
images/snek5.jpg
Normal file
After Width: | Height: | Size: 373 KiB |
BIN
images/snek6.jpg
Normal file
After Width: | Height: | Size: 227 KiB |
BIN
images/snek7.jpg
Normal file
After Width: | Height: | Size: 296 KiB |
BIN
images/snek8.jpg
Normal file
After Width: | Height: | Size: 144 KiB |
BIN
images/snek9.jpg
Normal file
After Width: | Height: | Size: 91 KiB |