Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
strolly
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dnns01
strolly
Commits
09e852ba
Commit
09e852ba
authored
4 years ago
by
dnns01
Browse files
Options
Downloads
Patches
Plain Diff
fix $11x - Allow mods to edit polls
parent
95060ed1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
poll_cog.py
+26
-2
26 additions, 2 deletions
poll_cog.py
with
26 additions
and
2 deletions
poll_cog.py
+
26
−
2
View file @
09e852ba
...
@@ -3,6 +3,8 @@ import os
...
@@ -3,6 +3,8 @@ import os
import
discord
import
discord
from
discord.ext
import
commands
from
discord.ext
import
commands
import
utils
OPTIONS
=
[
"
🇦
"
,
"
🇧
"
,
"
🇨
"
,
"
🇩
"
,
"
🇪
"
,
"
🇫
"
,
"
🇬
"
,
"
🇭
"
,
"
🇮
"
,
"
🇯
"
,
"
🇰
"
,
"
🇱
"
,
"
🇲
"
,
"
🇳
"
,
"
🇴
"
,
"
🇵
"
,
"
🇶
"
,
"
🇷
"
]
OPTIONS
=
[
"
🇦
"
,
"
🇧
"
,
"
🇨
"
,
"
🇩
"
,
"
🇪
"
,
"
🇫
"
,
"
🇬
"
,
"
🇭
"
,
"
🇮
"
,
"
🇯
"
,
"
🇰
"
,
"
🇱
"
,
"
🇲
"
,
"
🇳
"
,
"
🇴
"
,
"
🇵
"
,
"
🇶
"
,
"
🇷
"
]
...
@@ -21,6 +23,19 @@ class PollCog(commands.Cog):
...
@@ -21,6 +23,19 @@ class PollCog(commands.Cog):
await
channel
.
send
(
msg
)
await
channel
.
send
(
msg
)
@commands.command
(
name
=
"
edit-poll
"
)
@commands.check
(
utils
.
is_mod
)
async
def
cmd_edit_poll
(
self
,
ctx
,
message_id
,
question
,
*
answers
):
message
=
await
ctx
.
fetch_message
(
message_id
)
if
message
:
if
message
.
embeds
[
0
].
title
==
"
Umfrage
"
:
old_poll
=
Poll
(
self
.
bot
,
message
=
message
)
new_poll
=
Poll
(
self
.
bot
,
question
=
question
,
answers
=
answers
,
author
=
old_poll
.
author
)
await
new_poll
.
send_poll
(
ctx
.
channel
,
message
=
message
)
else
:
ctx
.
send
(
"
Fehler! Umfrage nicht gefunden!
"
)
pass
@commands.command
(
name
=
"
poll
"
)
@commands.command
(
name
=
"
poll
"
)
async
def
cmd_poll
(
self
,
ctx
,
question
,
*
answers
):
async
def
cmd_poll
(
self
,
ctx
,
question
,
*
answers
):
"""
Create poll
"""
"""
Create poll
"""
...
@@ -61,7 +76,7 @@ class Poll:
...
@@ -61,7 +76,7 @@ class Poll:
for
i
in
range
(
2
,
len
(
embed
.
fields
)):
for
i
in
range
(
2
,
len
(
embed
.
fields
)):
self
.
answers
.
append
(
embed
.
fields
[
i
].
value
)
self
.
answers
.
append
(
embed
.
fields
[
i
].
value
)
async
def
send_poll
(
self
,
channel
,
result
=
False
):
async
def
send_poll
(
self
,
channel
,
result
=
False
,
message
=
None
):
option_ctr
=
0
option_ctr
=
0
title
=
"
Umfrage
"
title
=
"
Umfrage
"
...
@@ -103,12 +118,21 @@ class Poll:
...
@@ -103,12 +118,21 @@ class Poll:
embed
.
add_field
(
name
=
name
,
value
=
value
,
inline
=
False
)
embed
.
add_field
(
name
=
name
,
value
=
value
,
inline
=
False
)
option_ctr
+=
1
option_ctr
+=
1
message
=
await
channel
.
send
(
""
,
embed
=
embed
)
if
message
:
await
message
.
edit
(
embed
=
embed
)
else
:
message
=
await
channel
.
send
(
""
,
embed
=
embed
)
await
message
.
clear_reaction
(
"
🗑️
"
)
await
message
.
clear_reaction
(
"
🛑
"
)
if
not
result
:
if
not
result
:
for
i
in
range
(
0
,
len
(
self
.
answers
)):
for
i
in
range
(
0
,
len
(
self
.
answers
)):
await
message
.
add_reaction
(
OPTIONS
[
i
])
await
message
.
add_reaction
(
OPTIONS
[
i
])
for
i
in
range
(
len
(
self
.
answers
),
len
(
OPTIONS
)):
await
message
.
clear_reaction
(
OPTIONS
[
i
])
await
message
.
add_reaction
(
"
🗑️
"
)
await
message
.
add_reaction
(
"
🗑️
"
)
await
message
.
add_reaction
(
"
🛑
"
)
await
message
.
add_reaction
(
"
🛑
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment