This commit is contained in:
matnad 2019-02-11 15:42:31 +01:00
parent c220b5b590
commit 06f4841104
3 changed files with 78 additions and 17 deletions

View File

@ -20,7 +20,7 @@ from essentials.settings import SETTINGS
logger = logging.getLogger('bot') logger = logging.getLogger('bot')
## Helvetica is the closest font to Whitney (discord uses Whitney) in afm ## Helvetica is the closest font to Whitney (discord uses Whitney) in afm
## This is used to estimate text width and adjust the layout of the embeds''' ## This is used to estimate text width and adjust the layout of the embeds
afm_fname = os.path.join(rcParams['datapath'], 'fonts', 'afm', 'phvr8a.afm') afm_fname = os.path.join(rcParams['datapath'], 'fonts', 'afm', 'phvr8a.afm')
with open(afm_fname, 'rb') as fh: with open(afm_fname, 'rb') as fh:
afm = AFM(fh) afm = AFM(fh)
@ -158,9 +158,7 @@ class Poll:
except InputError: except InputError:
pass pass
text = ("I will guide you step by step through the creation of your new poll." text = ("**What is the question of your poll?**\n"
"We can do this in a text channel or you can PM me to keep the server clean.\n"
"**How would you like your poll to be called?**\n"
"Try to be descriptive without writing more than one sentence.") "Try to be descriptive without writing more than one sentence.")
message = await self.wizard_says(text) message = await self.wizard_says(text)

View File

@ -56,8 +56,12 @@ async def on_ready():
await bot.change_presence(game=discord.Game(name=f'pm!help')) await bot.change_presence(game=discord.Game(name=f'pm!help'))
# check discord server configs # check discord server configs
server_admins = []
db_server_ids = [entry['_id'] async for entry in bot.db.config.find({}, {})] db_server_ids = [entry['_id'] async for entry in bot.db.config.find({}, {})]
for server in bot.servers: for server in bot.servers:
if server.owner not in server_admins:
server_admins.append(server.owner)
if server.id not in db_server_ids: if server.id not in db_server_ids:
# create new config entry # create new config entry
@ -66,20 +70,29 @@ async def on_ready():
{'$set': {'prefix': 'pm!', 'admin_role': 'polladmin', 'user_role': 'polluser'}}, {'$set': {'prefix': 'pm!', 'admin_role': 'polladmin', 'user_role': 'polluser'}},
upsert=True upsert=True
) )
print(", ".join([u.name for u in server_admins]))
#await import_old_database(bot, server)
# text = 'Test Update Notice. Please Ignore.'
text = "**Dear Server Admin!**\n\n" \
"After more than a year in the field, today Pollmaster received it's first big update and I am excited to present you the new Version!\n\n" \
"**TL;DR: A massive overhaul of every function. The new (now customizable) prefix is `pm!` and you can find the rest of the commands with `pm!help`**\n\n" \
"**Here are some more highlights:**\n" \
"🔹 Voting is no longer done per text, but by using reactions\n" \
"🔹 Creating new polls is now an interactive process instead of command lines\n" \
"🔹 There is now a settings for multiple choice polls\n" \
"🔹 You can use all the commands in a private message with Pollmaster to reduce spam in your channels\n\n" \
"For the full changelog, please visit: https://github.com/matnad/pollmaster/blob/master/changelog.md\n" \
"All your old polls should be converted to the new format and accessible with `pm!show` or `pm!show closed`.\n" \
"If you have any problems or questions, please join the support discord: https://discord.gg/Vgk8Nve\n\n" \
"**No action from you is required. But you might want to update permissions for your users. " \
"See pm!help -> configuration**\n\n" \
"I hope you enjoy the new Pollmaster!\n" \
"Regards, Newti#0654"
#await import_old_database(bot, server) embed = discord.Embed(title="Pollmaster updated to version 2!", description=text, color=SETTINGS.color)
# text = 'Test Update Notice. Please Ignore.' embed.set_thumbnail(url=SETTINGS.report_icon)
text = "Dear Server Admin!\n" \ embed.set_footer(text="This message will only be sent once and is to inform you of an important update.")
"After more than a year in the field, today Pollmaster received it's first big update and I am excited to present you the new Version!\n" \ await bot.send_message(bot.owner, embed= embed)
"**TL;DR** A massive overhaul of every function. The new (now customizable) prefix is pm! and you can find the rest of commands with pm!help\n\n" \
"Here are some more highlights:\n" \
"🔹 Voting is no longer done per text, but by using reactions\n" \
"🔹 Creating new polls is now an interactive process instead of command lines\n" \
"🔹 There is now a settings for multiple choice polls\n" \
"🔹 You can use all the commands in a private message with Pollmaster to reduce spam in your channels\n\n" \
"For the full changelog, please visit: "
# embed = discord.Embed(title="Pollmaster updated to version 2!", description=text, color=SETTINGS.color)
# await bot.send_message(server.owner, embed= embed)

50
readme.md Normal file
View File

@ -0,0 +1,50 @@
# Pollmaster V 2.0
## Overview
With Pollmaster you can very easily create and manage complex polls on your server.
Here is a quick list of features:
- Voting works with reactions (users don't need to type anything)
- Anonymous voting is possible
- Polls can be single- or multiple choice
- You can prepare polls in advance and schedule them to a date and time or manually activate them
- Polls can be given a deadline or they can be open until closed manually
- You can restrict which roles are allowed to participate
- You can assign weights to roles to count their votes more or less
- Polls are persistent and will be available until you delete them
- Everything can be done in private chat with the bot to reduce spam on the server
- Full multi-server support!
## The most important commands
| Command | Effect |
|------------------------|----------------------------------------------------|
| pm!help | Shows an interactive help menu |
| pm!new | Starts a new poll with all the settings |
| pm!quick | Starts a new poll with just a question and options |
| pm!prefix <new prefix> | Change the prefix for this server |
| pm!userrole <any role> | Set the role that has the rights to use the bot |
## Getting Started
Users with the server permission "Manage Server" will have all rights from the start, meaning you can get started with pm!new right away!
To grant users without "Manage Server" poll creation access to the bot, create and distribute the role *polladmin* or *polluser*. If you already have roles for these rights you can tell the bot by typing *pm!adminrole <your role>* and *pm!userrole <your role>*.
## Take a look!
Here is how Pollmaster looks in action:
![Pollmaster in action](https://i.imgur.com/vSXgd0r.png "Poll 1")
![Pollmaster in action](https://i.imgur.com/kMbnmiJ.png "Poll 2")
## Need help?
Join the support discord server by clicking the button on the top of the page.