示例#1
0
    async def on_raw_reaction_remove(self, payload):
        # check if bot react
        if payload.user_id == self.bot_user_id:
            return

        # check if grouphase is startet
        state_groupphase_isStarted = State.get('groupphase_isStarted')
        if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):
            state_groupphase_reaction_message = State.get(
                'groupphase_reaction_message')
            if (state_groupphase_reaction_message and int(state_groupphase_reaction_message.value) == payload.message_id):

                # check emoji
                if payload.emoji.name == '✅':
                    Groupphaseuser.delete(payload.user_id)
示例#2
0
    async def on_raw_reaction_add(self, payload):
        # check if bot react
        if payload.user_id == self.bot_user_id:
            return

        # check if grouphase is startet
        state_groupphase_isStarted = State.get('groupphase_isStarted')
        if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):
            state_groupphase_reaction_message = State.get(
                'groupphase_reaction_message')
            if (state_groupphase_reaction_message and int(state_groupphase_reaction_message.value) == payload.message_id):

                # check emoji
                if payload.emoji.name == '✅':

                    if (self.guild_fsr_role in payload.member.roles or self.guild_tutor_role in payload.member.roles):
                        channel = self.bot.get_channel(payload.channel_id)
                        message = await channel.fetch_message(payload.message_id)
                        user = discord.Member
                        user.id = payload.user_id
                        await message.remove_reaction(payload.emoji, user)
                    else:
                        course = None

                        if self.guild_inf_role in payload.member.roles:
                            course = 'inf'
                        elif self.guild_wi_role in payload.member.roles:
                            course = 'wi'
                        elif self.guild_et_role in payload.member.roles:
                            course = 'et'
                        elif self.guild_mcd_role in payload.member.roles:
                            course = 'mcd'

                        if course != None:
                            Groupphaseuser.set(payload.user_id, course)
                        else:
                            channel = self.bot.get_channel(payload.channel_id)
                            message = await channel.fetch_message(payload.message_id)
                            user = discord.Member
                            user.id = payload.user_id
                            await message.remove_reaction(payload.emoji, user)

                else:
                    channel = self.bot.get_channel(payload.channel_id)
                    message = await channel.fetch_message(payload.message_id)
                    user = discord.Member
                    user.id = payload.user_id
                    await message.remove_reaction(payload.emoji, user)
示例#3
0
    async def stats(self, ctx):
        # create output embed
        embed = discord.Embed(
            colour=discord.Colour.blue(),
            title="Stats",
        )

        members_total = len(self.bot.users)
        members_online = 0
        for member in self.bot.get_all_members():
            if member.status == discord.Status.online:
                members_online += 1

        embed.add_field(name='Mitglieder',
                        value=f'{members_online} von {members_total} online',
                        inline=False)

        embed.add_field(
            name='Shards',
            value=
            f'Shard {ctx.guild.shard_id + 1} von {len(self.bot.shards)} (ID: {ctx.guild.shard_id})',
            inline=False)

        embed.add_field(name='Nachrichten',
                        value=str(State.get('guild_message_count').value),
                        inline=False)

        # send message
        await ctx.send(ctx.author.mention, embed=embed)
示例#4
0
文件: base.py 项目: sunu/oppia-test
    def test_editor(self, exploration_id, state_id=None, **kwargs):
        """Gets the user and exploration id if the user can edit it.

        Args:
            self: the handler instance
            exploration_id: the exploration id
            state_id: the state id, if it exists
            **kwargs: any other arguments passed to the handler

        Returns:
            The user and exploration instance, if the user is authorized to edit
            this exploration. Also, the state instance, if one is supplied.

        Raises:
            self.NotLoggedInException: if there is no current user.
            self.UnauthorizedUserException: if the user exists but does not have
                the right credentials.
        """
        user = users.get_current_user()
        if not user:
            self.redirect(users.create_login_url(self.request.uri))
            return

        exploration = Exploration.get(exploration_id)

        if not exploration.is_editable_by(user):
            raise self.UnauthorizedUserException(
                '%s does not have the credentials to edit this exploration.',
                user)

        if not state_id:
            return handler(self, user, exploration, **kwargs)
        state = State.get(state_id, exploration)
        return handler(self, user, exploration, state, **kwargs)
示例#5
0
 def create(cls, name, state):
     state_rec = State.get(state)
     if state_rec:
         id = int(datetime.timestamp(datetime.now()) * 1000)
         body = {"name": name, "state": state_rec["name"]}
         res = es.index(index=os.environ.get("INDEX"),
                        doc_type='city',
                        id=id,
                        parent=state_rec["id"],
                        body=body)
         if "created" in res and res["created"]:
             return True
     return False
示例#6
0
 def edit(cls, id, name, state):
     state_rec = State.get(state)
     if state_rec:
         res = es.index(index=os.environ.get("INDEX"),
                        doc_type='city',
                        id=id,
                        parent=state_rec["id"],
                        body={
                            "name": name,
                            "state": state_rec["name"]
                        })
         if "result" in res and res["result"] == "updated":
             return True
     return False
示例#7
0
    def __init__(self, bot):
        self.bot = bot

        self.bot_user_id = os.getenv('BOT_USER_ID')
        if isinstance(self.bot_user_id, str):
            self.bot_user_id = int(self.bot_user_id)

        guild_message_count = State.get('guild_message_count')
        self.guild_message_count = 0

        if not guild_message_count:
            State.set('guild_message_count', "0")
        else:
            self.guild_message_count = int(guild_message_count.value)

        self.update_in_db.start()
示例#8
0
    async def on_raw_reaction_add(self, payload):
        # check if bot react
        if payload.user_id == self.bot_user_id:
            return

        guild_study_course_message = State.get(
            'guild_study_course_message')

        if guild_study_course_message:

            channel = self.bot.get_channel(
                self.guild_study_course_channel_id
            )

            if (guild_study_course_message and int(guild_study_course_message.value) == payload.message_id):

                guild = self.bot.get_guild(payload.guild_id)

                msg = await channel.fetch_message(int(guild_study_course_message.value))

                role_inf = guild.get_role(self.guild_inf_role_id)
                role_wi = guild.get_role(self.guild_wi_role_id)
                role_mcd = guild.get_role(self.guild_mcd_role_id)
                role_et = guild.get_role(self.guild_et_role_id)

                if payload.emoji.name == '🇮':
                    await payload.member.add_roles(role_inf)
                    await payload.member.remove_roles(role_wi, role_mcd, role_et)

                elif payload.emoji.name == '🇼':
                    await payload.member.add_roles(role_wi)
                    await payload.member.remove_roles(role_inf, role_mcd, role_et)

                elif payload.emoji.name == '🇪':
                    await payload.member.add_roles(role_et)
                    await payload.member.remove_roles(role_wi, role_mcd, role_inf)

                elif payload.emoji.name == '🇲':
                    await payload.member.add_roles(role_mcd)
                    await payload.member.remove_roles(role_wi, role_inf, role_et)

                await msg.remove_reaction(payload.emoji, payload.member)
示例#9
0
    async def group(self, ctx):
        # check if grouphase is startet
        state_groupphase_isStarted = State.get('groupphase_isStarted')
        if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):

            # check channel
            current_group = Group.getByTextChannelId(ctx.channel.id)
            if current_group:

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.blue(),
                    title=f'Gruppe: {current_group.name}'
                )

                # get members
                current_members = Groupphaseuser.getAllByGroupID(
                    current_group.id)
                current_members_total = len(current_members)

                embed.add_field(name='Teilnehmeranzahl',
                                value=f'{current_members_total}', inline=False)

                # get users
                current_user_list = []
                for member in current_members:
                    try:
                        current_user_list.append(self.bot.get_user(member.id))
                    except Exception:
                        pass

                if len(current_user_list) > 0:
                    output = ', '.join((u.mention for u in current_user_list))
                    embed.add_field(name='Teilnehmer',
                                    value=f'{output}', inline=False)

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)
示例#10
0
def state_edit(id, country):
    state_form = EditStateForm()
    if request.method == 'POST':
        if not state_form.validate():
            flash('All fields are required.')
            return render_template('crud/state/edit.html', form=state_form)
        else:
            result = State.edit(request.form["id"], request.form["name"],
                                request.form["country"])
            if result:
                flash('State edited successfully!!!')
                return redirect(url_for('state'))
            else:
                flash('Unable to edit state.')
                return render_template('crud/state/edit.html', form=state_form)
    else:
        state = State.get(id)
        if not state:
            return redirect(url_for('state'))
        state_form.name.data = state["name"]
        state_form.country.data = state["parent"]
        state_form.id.data = state["id"]
        state_form.country_id.data = country
        return render_template('crud/state/edit.html', form=state_form)
示例#11
0
文件: reader.py 项目: sunu/oppia-test
    def post(self, exploration_id, state_id):
        """Handles feedback interactions with readers."""
        values = {'error': []}

        exploration = Exploration.get(exploration_id)
        state = State.get(state_id, exploration)
        old_state = state

        payload = json.loads(self.request.get('payload'))

        # The 0-based index of the last content block already on the page.
        block_number = payload.get('block_number')
        params = self.get_params(state, payload.get('params'))
        # The reader's answer.
        answer = payload.get('answer')

        # Add the reader's answer to the parameter list. This must happen before
        # the interactive widget is constructed.
        params['answer'] = answer

        interactive_widget_properties = (
            InteractiveWidget.get_with_params(
                state.widget.widget_id)['actions']['submit'])

        dest_id, feedback, rule, recorded_answer = state.transition(
            answer, params, interactive_widget_properties)

        if recorded_answer:
            EventHandler.record_rule_hit(
                exploration_id, state_id, rule, recorded_answer)
            # Add this answer to the state's 'unresolved answers' list.
            if recorded_answer not in old_state.unresolved_answers:
                old_state.unresolved_answers[recorded_answer] = 0
            old_state.unresolved_answers[recorded_answer] += 1
            # TODO(sll): Make this async?
            old_state.put()

        assert dest_id

        html_output, widget_output = '', []
        # TODO(sll): The following is a special-case for multiple choice input,
        # in which the choice text must be displayed instead of the choice
        # number. We might need to find a way to do this more generically.
        if state.widget.widget_id == 'MultipleChoiceInput':
            answer = state.widget.params['choices'][int(answer)]

        # Append reader's answer.
        values['reader_html'] = feconf.JINJA_ENV.get_template(
            'reader_response.html').render({'response': answer})

        if dest_id == feconf.END_DEST:
            # This leads to a FINISHED state.
            if feedback:
                html_output, widget_output = self.append_feedback(
                    feedback, html_output, widget_output, block_number, params)
            EventHandler.record_exploration_completed(exploration_id)
        else:
            state = State.get(dest_id, exploration)
            EventHandler.record_state_hit(exploration_id, state_id)

            if feedback:
                html_output, widget_output = self.append_feedback(
                    feedback, html_output, widget_output, block_number, params)

            # Append text for the new state only if the new and old states
            # differ.
            if old_state.id != state.id:
                state_html, state_widgets = parse_content_into_html(
                    state.content, block_number, params)
                # Separate text for the new state and feedback for the old state
                # by an additional line.
                if state_html and feedback:
                    html_output += '<br>'
                html_output += state_html
                widget_output.append(state_widgets)

        if state.widget.widget_id in DEFAULT_ANSWERS:
            values['default_answer'] = DEFAULT_ANSWERS[state.widget.widget_id]
        values['exploration_id'] = exploration.id
        values['state_id'] = state.id
        values['oppia_html'] = html_output
        values['widgets'] = widget_output
        values['block_number'] = block_number + 1
        values['params'] = params

        if dest_id != feconf.END_DEST:
            values['finished'] = False
            if state.widget.sticky and (
                    state.widget.widget_id == old_state.widget.widget_id):
                values['interactive_widget_html'] = ''
                values['sticky_interactive_widget'] = True
            else:
                values['interactive_widget_html'] = (
                    InteractiveWidget.get_raw_code(
                        state.widget.widget_id,
                        params=utils.parse_dict_with_params(
                            state.widget.params, params)
                    )
                )
        else:
            values['finished'] = True
            values['interactive_widget_html'] = ''

        self.response.write(json.dumps(values))
示例#12
0
    async def groupphase(self, ctx, type:  typing.Optional[str], groupamount: typing.Optional[int]):
        if type:
            type = type.lower()

        if type == 'start':
            # check if grouphase is already startet
            state_groupphase_isStarted = State.get('groupphase_isStarted')
            if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.red(),
                    title=f'Es läuft schon eine Gruppenphase! Beende erst die alte, bevor du eine neue startest.'
                )

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)

            else:

                # check if guild_announcements_channel_id isset
                if self.guild_announcements_channel_id > 0:
                    guild_announcements_channel = self.bot.get_channel(
                        self.guild_announcements_channel_id)

                    # check if channel was found
                    if guild_announcements_channel:
                        announcement_message = await guild_announcements_channel.send('Hallo @everyone,\neine neue Gruppenphase wurde gerade gestartet! Wenn du mitmachen willst, reagiere einfach mit einem :white_check_mark: auf diese Nachricht!')
                        await announcement_message.add_reaction('✅')

                        # start groupphase
                        State.set('groupphase_isStarted', str(True))
                        State.set('groupphase_reaction_message',
                                  announcement_message.id)

                        # create output embed
                        embed = discord.Embed(
                            colour=discord.Colour.green(),
                            title=f'Die Gruppenphase wurde erfolgreich gestartet!'
                        )

                        # send embed
                        await ctx.send(ctx.author.mention, embed=embed)

                    else:
                        # create output embed
                        embed = discord.Embed(
                            colour=discord.Colour.red(),
                            title=f'Der Ankündigung-Kanal wurde nicht gefunden. Überprüfe in der `.env`-Datei den Parameter `GUILD_ANNOUNCEMENTS_CHANNEL`.'
                        )

                        # send embed
                        await ctx.send(ctx.author.mention, embed=embed)

                else:
                    # create output embed
                    embed = discord.Embed(
                        colour=discord.Colour.red(),
                        title=f'Bitte setze in der `.env`-Datei den Parameter `GUILD_ANNOUNCEMENTS_CHANNEL`.'
                    )

                    # send embed
                    await ctx.send(ctx.author.mention, embed=embed)

        elif type == 'stop':
            # check if grouphase is startet
            state_groupphase_isStarted = State.get('groupphase_isStarted')
            if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):

                # delete all groups
                for group in Group.all():
                    try:
                        await ctx.guild.get_role(group.role).delete()
                    except Exception:
                        pass

                    try:
                        await ctx.guild.get_channel(group.textChannel).delete()
                    except Exception:
                        pass

                    try:
                        await ctx.guild.get_channel(group.voiceChannel).delete()
                    except Exception:
                        pass

                    Group.delete(group.id)

                # delete groupphase user
                Groupphaseuser.deleteall()

                # delete groupphase
                State.delete('groupphase_isStarted')
                State.delete('groupphase_reaction_message')

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.green(),
                    title=f'Die Gruppenphase wurde erfolgreich beendet!'
                )

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)

            else:

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.red(),
                    title=f'Es läuft keine Gruppenphase, die du beenden könntest!'
                )

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)

        elif type in ['sort', 'inf', 'wi', 'et', 'mcd']:
            # check if grouphase is startet
            state_groupphase_isStarted = State.get('groupphase_isStarted')
            if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):

                # check if groupamount parameter isset
                if groupamount:
                    if groupamount < 2:
                        groupamount = 2
                    elif groupamount > 100:
                        groupamount = 100

                    # create output embed
                    embed = discord.Embed(
                        colour=discord.Colour.blue(),
                        title="Einteilung der Gruppenphase beginnt",
                    )

                    if type == 'sort':
                        members_total = len(Groupphaseuser.all())
                        embed.add_field(name='Teilnehmer',
                                        value=f'{members_total}', inline=False)
                    elif type == 'inf':
                        members_total = len(Groupphaseuser.inf())
                        embed.add_field(name='Teilnehmer (INF)',
                                        value=f'{members_total}', inline=False)
                    elif type == 'wi':
                        members_total = len(Groupphaseuser.wi())
                        embed.add_field(name='Teilnehmer (WI)',
                                        value=f'{members_total}', inline=False)
                    elif type == 'et':
                        members_total = len(Groupphaseuser.et())
                        embed.add_field(name='Teilnehmer (ET)',
                                        value=f'{members_total}', inline=False)
                    elif type == 'mcd':
                        members_total = len(Groupphaseuser.mcd())
                        embed.add_field(name='Teilnehmer (MCD)',
                                        value=f'{members_total}', inline=False)

                    embed.add_field(name='Gruppenanzahl',
                                    value=f'{groupamount}', inline=False)
                    embed.add_field(name='Max. Teilnehmer pro Gruppe',
                                    value=f'{math.ceil(members_total/groupamount)}', inline=False)

                    # send message
                    await ctx.send(ctx.author.mention, embed=embed)

                    for x in range(groupamount):
                        if type == 'sort':
                            groupname = 'Gruppe ' + str((x) + 1)
                        else:
                            groupname = type.upper() + '-Gruppe ' + str((x) + 1)

                        role = await ctx.guild.create_role(name=groupname, hoist=False)

                        if self.guild_tutor_sup_role != None:
                            overwrites = {
                                ctx.guild.default_role: discord.PermissionOverwrite(
                                    view_channel=False,
                                    read_messages=False,
                                    connect=False,
                                ),
                                role: discord.PermissionOverwrite(
                                    view_channel=True,
                                    read_messages=True,
                                    connect=True,
                                ),
                                self.guild_tutor_sup_role: discord.PermissionOverwrite(
                                    view_channel=True,
                                    read_messages=True,
                                    connect=True,
                                ),
                            }
                        else:
                            overwrites = {
                                ctx.guild.default_role: discord.PermissionOverwrite(
                                    view_channel=False,
                                    read_messages=False,
                                    connect=False,
                                ),
                                role: discord.PermissionOverwrite(
                                    view_channel=True,
                                    read_messages=True,
                                    connect=True,
                                )
                            }

                        voiceChannel = await ctx.guild.create_voice_channel(name=groupname, overwrites=overwrites)
                        textChannel = await ctx.guild.create_text_channel(name=groupname, overwrites=overwrites)

                        group = Group(groupname, role.id,
                                      voiceChannel.id, textChannel.id)
                        if type == 'inf':
                            group.course = "inf"
                        elif type == 'wi':
                            group.course = "wi"
                        elif type == 'et':
                            group.course = "et"
                        elif type == 'mcd':
                            group.course = "mcd"

                        db_session.add(group)
                        db_session.commit()

                    # create output embed
                    embed = discord.Embed(
                        colour=discord.Colour.green(),
                        title=f'Gruppen erfolgreich angelegt!'
                    )

                    # send embed
                    await ctx.send(ctx.author.mention, embed=embed)

                    # create output embed
                    embed = discord.Embed(
                        colour=discord.Colour.blue(),
                        title=f'Beginne mit der Einteilung der Teilnehmer.'
                    )

                    # send embed
                    await ctx.send(ctx.author.mention, embed=embed)

                    if type == 'sort':
                        groups = Group.all()
                        allWithoutGroups = Groupphaseuser.allWithoutGroup()
                    elif type == 'inf':
                        groups = Group.inf()
                        allWithoutGroups = Groupphaseuser.allWithoutGroupInf()
                    elif type == 'wi':
                        groups = Group.wi()
                        allWithoutGroups = Groupphaseuser.allWithoutGroupWi()
                    elif type == 'et':
                        groups = Group.et()
                        allWithoutGroups = Groupphaseuser.allWithoutGroupEt()
                    elif type == 'mcd':
                        groups = Group.mcd()
                        allWithoutGroups = Groupphaseuser.allWithoutGroupMcd()
                    else:
                        return

                    counter = 0

                    for user in allWithoutGroups:
                        if counter >= groupamount:
                            counter = 0

                        user.groupID = groups[counter].id
                        userDiscord = ctx.guild.get_member(user.id)
                        role = ctx.guild.get_role(groups[counter].role)
                        await userDiscord.add_roles(role)

                        counter += 1
                        db_session.commit()

                    # create output embed
                    embed = discord.Embed(
                        colour=discord.Colour.green(),
                        title=f'Teilnehmer erfolgreich eingeteilt!'
                    )

                    # send embed
                    await ctx.send(ctx.author.mention, embed=embed)

                else:

                    # create output embed
                    embed = discord.Embed(
                        colour=discord.Colour.red(),
                        title=f'Bitte füge noch den Parameter `groupamount` hinzu.'
                    )

                    # send embed
                    await ctx.send(ctx.author.mention, embed=embed)

            else:

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.red(),
                    title=f'Es läuft keine Gruppenphase, die du einteilen könntest!'
                )

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)

        else:

            # check if grouphase is startet
            state_groupphase_isStarted = State.get('groupphase_isStarted')
            if (state_groupphase_isStarted and state_groupphase_isStarted.value == str(True)):

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.blue(),
                    title="Informationen zur Gruppenphase",
                )

                members_total = len(Groupphaseuser.all())

                embed.add_field(name='Teilnehmer',
                                value=f'{members_total}', inline=False)

                inf_total = len(Groupphaseuser.inf())

                embed.add_field(name='INF',
                                value=f'{inf_total}', inline=False)

                wi_total = len(Groupphaseuser.wi())

                embed.add_field(name='WI',
                                value=f'{wi_total}', inline=False)

                et_total = len(Groupphaseuser.et())

                embed.add_field(name='ET',
                                value=f'{et_total}', inline=False)

                mcd_total = len(Groupphaseuser.mcd())

                embed.add_field(name='MCD',
                                value=f'{mcd_total}', inline=False)

                # send message
                await ctx.send(ctx.author.mention, embed=embed)

            else:

                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.red(),
                    title=f'Es läuft keine Gruppenphase, über die du Informationen anfodern kannst!'
                )

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)
示例#13
0
    async def studyProgram(self, ctx, active: typing.Optional[str]):
        if active:
            active = active.lower()

        # in general we does not care whether a message was already send or not

        # post message with content
        if active == 'start':
            guild_study_course_message = State.get(
                'guild_study_course_message')

            if guild_study_course_message:
                # create output embed
                embed = discord.Embed(
                    colour=discord.Colour.red(),
                    title=f'Es existiert bereits eine Nachricht, welche die Verteilung der Studiengänge behandelt.'
                )

                # send embed
                await ctx.send(ctx.author.mention, embed=embed)
                return

            if self.guild_study_course_channel_id > 0:
                guild_study_course_channel = self.bot.get_channel(
                    self.guild_study_course_channel_id
                )

                if guild_study_course_channel:
                    command_message = await guild_study_course_channel.send(
                        'Hallo @everyone,\n' +
                        'Ab sofort könnt ihr euch eurem Studiengang zuordnen! Dies passiert indem du auf diese Nachricht reagierst.\n' +
                        'Die entsprechenden Buchstaben sind wie folgt zu verstehen:\n' +
                        ':regional_indicator_i: - Informatik\n' +
                        ':regional_indicator_w: - Wirtschaftsinformatik\n' +
                        ':regional_indicator_e: - Elektrotechnik\n' +
                        ':regional_indicator_m: - Media and Communications for Digital Business'
                    )
                    await command_message.add_reaction('🇮')
                    await command_message.add_reaction('🇼')
                    await command_message.add_reaction('🇪')
                    await command_message.add_reaction('🇲')
                    if command_message:
                        State.set('guild_study_course_message',
                                  command_message.id)

        if active == 'stopp':
            guild_study_course_message = State.get(
                'guild_study_course_message')

            if guild_study_course_message:
                channel = self.bot.get_channel(
                    self.guild_study_course_channel_id)
                msg = await channel.fetch_message(int(guild_study_course_message.value))
                if msg:
                    await msg.delete()
                State.delete('guild_study_course_message')
            else:
                embed = discord.Embed(
                    colour=discord.Colour.red(),
                    title=f'Es existiert keine Nachricht, welche die Verteilung der Studiengänge behandelt.'
                )
                # send embed
                await ctx.send(ctx.author.mention, embed=embed)